Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get userid in membership?

i know how to get userid for a current user

 MembershipUser currentUser = Membership.GetUser();
 Guid currentUserId = (Guid)currentUser.ProviderUserKey;

But for my application i need to get userid of user who are not loginned in also. Because i need to assign the userid to different table which i m using.

Thank you in Advance

like image 853
Nimmy Avatar asked Mar 05 '10 21:03

Nimmy


People also ask

How does membership GetUser work?

GetUser() retrieves the user information from the data source and creates a MembershipUser object populated with the returned data. If you use one of the GetUser overloads that does not take a username parameter, GetUser returns the information for the current logged-on membership user.

How does ASP Net membership work?

The ASP.NET membership provider is a feature that enables ASP.NET developers to create Web sites that allow users to create unique user name and password combinations. With this facility, any user can establish an account with the site, and sign in for exclusive access to the site and its services.


1 Answers

Use the Membership.GetUser(username, userIsOnline) method, passing false as the userIsOnline parameter.

like image 179
technophile Avatar answered Sep 28 '22 02:09

technophile