Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All
I want to get the UserId of the user that register now. my table's ID is uniqueidentifier. thanks.

What I have tried:

MembershipUser user = Membership.GetUser(CreateUserWizard1.UserName);
Guid userId = (Guid)user.ProviderUserKey;
Posted
Updated 6-Oct-18 8:02am
Comments
summiya1 8-Oct-18 13:55pm    
Your Question is not clear but why you are casting Guid here If its already in Guid format

Guid userId = (Guid)user.ProviderUserKey;

Guid userId = user.ProviderUserKey;
Richard Deeming 9-Oct-18 13:34pm    
The ProviderUserKey property[^] returns an object; you have to cast it to the appropriate type.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900