简体   繁体   English

使用c#的asp.net自定义成员资格提供程序

[英]Custom Membership Provider for asp.net using c#

How i can realise my own Membership Provider for my social network example project where i want to use more extended registration with new fields? 如何为我的社交网络示例项目实现自己的成员资格提供程序,我想在新字段中使用更多扩展注册? Thanks. 谢谢。

Membership Providers are not meant for holding user profile details, their purpose is to give your application a mechanism for authentication and user-management - that's it. 成员资格提供程序不是用于保存用户配置文件详细信息,其目的是为您的应用程序提供身份验证和用户管理机制 - 就是这样。 Like, Fermin correctly said, create a seperate table with one-to-one relation with your primary membership provider table on its UserId. 就像,Fermin正确地说,在UserId上创建一个与主要成员资格提供者表一对一关系的单独表。 Given this fact, you actually don't need a custom membership provider unless your member provider has to work against a different table with different schema for holding membership details. 鉴于这一事实, you actually don't need a custom membership provider除非您的成员提供程序必须针对具有不同架构的其他表来处理成员身份详细信息。

You could use the default Memership Provider details and create another table to store the extended registration details that you need to store. 您可以使用默认的Memership Provider详细信息并创建另一个表来存储您需要存储的扩展注册详细信息。

You can then have a foreign key in this new table storing a link to the Membership Provider User table. 然后,您可以在此新表中拥有一个外键,其中存储了一个指向Membership Provider User表的链接。 You can then link back to this and update,view,insert and of the extra information as and when you need to? 然后,您可以链接回到此并在需要时更新,查看,插入和获取额外信息?

You can add a ProfileProvider which works with and extends the MembershipProvider. 您可以添加一个ProfileProvider ,它可以使用MembershipProvider并对其进行扩展。 Have a look at this blog from Scott Guthrie: http://weblogs.asp.net/scottgu/archive/2006/01/10/435038.aspx 看看Scott Guthrie撰写的这篇博客: http//weblogs.asp.net/scottgu/archive/2006/01/10/435038.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM