System.Web.UI.WebControls.LoginStatus Class

Detects the user's authentication state and toggles the state of a link to log in to or log out of a Web site.

See Also: LoginStatus Members

Syntax

[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.LoginStatusDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
[System.ComponentModel.DefaultEvent("LoggingOut")]
[System.ComponentModel.Bindable(false)]
public class LoginStatus : CompositeControl

Remarks

In this topic:

Introduction

The System.Web.UI.WebControls.LoginStatus control has two states, logged in to the Web site and logged out of the Web site, determined by the System.Web.HttpRequest.IsAuthenticated property of the System.Web.UI.Page object's System.Web.UI.Page.Request property.

The System.Web.UI.WebControls.LoginStatus control displays either a text or an image link, depending on the setting of the LoginStatus.LoginImageUrl and LoginStatus.LogoutImageUrl properties. You can display either text or images for one or both states.

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.

When a user is not logged in to the site, the System.Web.UI.WebControls.LoginStatus control provides a link to the login page defined in the application configuration settings. When the user is logged in to the Web site, the System.Web.UI.WebControls.LoginStatus control provides a link to log out of the Web site. Logging out of the Web site clears the user's authentication status and when using cookies will clear the cookie from the user's client computer. On any subsequent visit to the Web site, the System.Web.UI.WebControls.LoginStatus control will display the prompt to log in.

The logout behavior is controlled by the LoginStatus.LogoutAction property, which specifies whether to refresh the current page, redirect the user to the login page defined in the application configuration settings, or redirect the user to a page specified by the LoginStatus.LogoutPageUrl property. The default is to refresh the current page.

Note:

When a user uses the System.Web.UI.WebControls.LoginStatus control to log out of a Web site, all data present in view state and all post data is lost.

Declarative Syntax

Example

<asp:LoginStatus
    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