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
In this topic:
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.
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.
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.
<asp:LoginStatus AccessKey="string" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="