frenchie
frenchie

Reputation: 51937

userid from asp.net Membership Authentication?

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 actual userID and what's its datatype?

Upvotes: 3

Views: 6552

Answers (2)

DavRob60
DavRob60

Reputation: 3557

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.

Upvotes: 0

Katie Kilian
Katie Kilian

Reputation: 6995

Use the ProviderUserKey member of the MembershipUser object, like this:

MembershipUser user = Membership.GetUser();
string id = user.ProviderUserKey.ToString();

Upvotes: 12

Related Questions