3

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?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
frenchie
  • 51,731
  • 109
  • 304
  • 510

2 Answers2

12

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

MembershipUser user = Membership.GetUser();
string id = user.ProviderUserKey.ToString();
Katie Kilian
  • 6,815
  • 5
  • 41
  • 64
0

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.

DavRob60
  • 3,517
  • 7
  • 34
  • 56