What is the best way to implement Users & Roles Au

2019-07-31 20:06发布

I am looking to see what is the best way to implement asp.net membership in an MVC 3 project. One thing to note is that I have a separate users table and would like to still use this. So can I link my users table to the asp.net memberships table?

Cheers, Noel.

2条回答
Emotional °昔
2楼-- · 2019-07-31 20:46

Description

You can implement your own MembershipProvider. Then you have full control about how authentification works and wich database / tables are relevant.

I think you dont need the default asp.net membership database.

More Information

Create a Custom Membership Provider?

查看更多
We Are One
3楼-- · 2019-07-31 20:47

You can create an additional field (unique identified type) on your custom table and link it to the membership users table.

create new user, if succeed then get id for the newly created user and insert it to your custom table.

MembershipUser mUser= Membership.GetUser(username);
Guid myId =  (Guid)mUser.ProviderUserKey;

...Insert my/id to your custom table.

查看更多
登录 后发表回答