In this login screen record get inserted into aspnet_membership table of sql server. UserName and password get stored to this table in encrypted form. I want to retrive Userneme each time when user login with his userid and password and get stored into my different master tables. So problem is that how I can retrive UserName from login screen and get stored into another database tables as UserID?
How to retrive userid
I have a login screen like this.

In this login screen record get inserted into aspnet_membership table of sql server. UserName and password get stored to this table in encrypted form. I want to retrive Userneme each time when user login with his userid and password and get stored into my different master tables. So problem is that how I can retrive UserName from login screen and get stored into another database tables as UserID?
In this login screen record get inserted into aspnet_membership table of sql server. UserName and password get stored to this table in encrypted form. I want to retrive Userneme each time when user login with his userid and password and get stored into my different master tables. So problem is that how I can retrive UserName from login screen and get stored into another database tables as UserID?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Alok UniyalRank #8,369 · 223 reputationPosted Apr 11, 2013, 8:46 PM EDT
Try this-
For username:
string username = Membership.GetUser().UserName;
For userid:
Guid uid =(Guid) Membership.GetUser().ProviderUserKey;
Nilesh AvhadRank #3,587 · 406 reputationPosted Apr 11, 2013, 9:29 PM EDT
Alok UniyalRank #8,369 · 223 reputationPosted Apr 11, 2013, 10:53 PM EDT