Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Display the Name of the Current User

You can display the name of the current user using the LoginName control. This control displays the user ID of the current logged-in user, whether the user's identity is established with ASP.NET login controls (and implicitly, ASP.NET membership) or with Integrated Windows authentication.

NoteNote

The current user's login name will appear only if the user has been authenticated. If the user has not logged in, the control is not rendered.

To display the current user name

  • Place a LoginName control on your page using the following syntax:

    <asp:LoginName id="LoginName1" runat="server" 
                   FormatString ="Welcome, {0}" />
    

See Also

Community Additions

ADD
Show:
© 2015 Microsoft