ASP.NET 2.0 - Get the Username of the currently logged in user.

Posted on 2007-07-25
Last Modified: 2013-11-26
How do i get the username of the user who is currently logged in to the pc in ASP.NET 2.0? I'm doing a small web forms APP and need to put the username into a Label control. The user is logged into the Windows account which is a client pc on the active directory network.
Question by:sergeiweerasuriya
    LVL 14

    Accepted Solution

    LVL 14

    Expert Comment

    LVL 2

    Assisted Solution

    Following will give you the Username of Currently Logged In User
    Dim UserName As String
            UserName = User.Identity.Name.ToString()

    Full path hierarchy including the Namespace path

    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 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