System.Web.UI.WebControls.LoginName Class

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

See Also: LoginName Members

Syntax

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

Remarks

In this topic:

Introduction

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.

Note:

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.

Note:

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.

Accessibility

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

Example

<asp:LoginName
    AccessKey="string"
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="

Requirements

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