I'm using the asp.net login control for user authentication. I also have the userID in many tables in my application and for now (development purposes), the userID is an int that I'm making up. However, I'd like to start using the userID of the framework in my tables. Where and how do I access the ac开发者_如何学Pythontual userID and what's its datatype?
Use the ProviderUserKey
member of the MembershipUser
object, like this:
MembershipUser user = Membership.GetUser();
string id = user.ProviderUserKey.ToString();
In the aspnet_Users
Table there is a UserId
field with the uniqueidentifier
datatype.
You could add the membership table into your own database instead of a separated one.
精彩评论