How to tie SqlRoleProvider to “My” user table

2019-05-31 05:22发布

问题:

How to tie SqlRoleProvider to "My" user table

I am using asp.net MVC and SqlRoleProvider appears to work out of the box. However I have my own users and roles. I have a user table the has all the user/personalized data. How do I tie the account controller back to my table. My table has a userID and I use that to tie other actions to a particular user.

Would be great if I could use the account controller and after the user logs in, I have their ID.

I have been looking at this but is not quite the same as asp.net mvc

http://www.4guysfromrolla.com/articles/121405-1.aspx

回答1:

Not sure if this is the same in asp.net mvc, but we use the SqlMembership provider for authentication with gives us back a MembershipUser object. The MembershipUser instance has a ProviderUserKey property which we map to our own user table's MemberId field (which is different to our internal UserId).