System.Web.UI.WebControls.LoginName Class

Displays the value of the System.Web.UI.Page.User.Identity.Name property.

See Also: LoginName Members


[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.LoginNameDesigner,System.Design, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
public class LoginName : WebControl


In this topic:


By default, the System.Web.UI.WebControls.LoginName control displays the name contained in the System.Web.UI.Page.User property of the System.Web.UI.Page class. If the System.Web.UI.Page.User.Identity.Name property is empty, the control is not rendered.


If you are not familiar with the set of login controls available in ASP.NET, see ASP.NET Login Controls Overview before continuing. For a list of other topics related to login controls and membership, see Managing Users By Using Membership.

To change the text displayed by the System.Web.UI.WebControls.LoginName control, set the LoginName.FormatString property.


The System.Web.UI.WebControls.LoginName control cannot be used outside the <form> tag on a Web page. Specifically, the System.Web.UI.WebControls.LoginName cannot be used to put the user's name in the title of a page.


For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.

Declarative Syntax


    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"


Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions:
Since: .NET 2.0