[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 718
  • Last Modified:

How to programmatically get a logged in MembershipUser

The Membership class should have a function called: GetLoggedInUser()

The smart LoginStatus control can do it, but I can't figure out how to do it in my code.
0
zorci
Asked:
zorci
1 Solution
 
DhaestCommented:
The GetUser method has a number of overloads. If used without passing in any parameters, it returns information about the currently logged in user. To get information about a particular user, call GetUser passing in their username. Either way, GetUser returns a MembershipUser object, which has properties like UserName, Email, IsApproved, IsOnline, and so on.

Validating User Credentials Against the Membership User Store
http://www.asp.net/LEARN/security/tutorial-06-cs.aspx


MembershipUser usrInfo = Membership.GetUser(myLogin.UserName);
          if (usrInfo != null )
          {
          }
          else
          {
          }

Open in new window

0
 
zorciAuthor Commented:
Fantastic. Thanks a lot. :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now