How to programmatically get a logged in MembershipUser

Posted on 2009-02-19
Last Modified: 2012-06-21
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.
Question by:zorci
    LVL 53

    Accepted Solution

    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

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

    Open in new window


    Author Comment

    Fantastic. Thanks a lot. :)

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now