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.
Assembly: System.Web (in System.Web.dll)
[BindableAttribute(false)] [AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)] [AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)] public ref class LoginStatus : public CompositeControl
<asp:LoginStatus />
The LoginStatus control has two states, logged in to the Web site and logged out of the Web site, determined by the IsAuthenticated property of the Page object's Request property.
The LoginStatus control displays either a text or an image link, depending on the setting of the LoginImageUrl and 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 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 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 LoginStatus control will display the prompt to log in.
The logout behavior is controlled by the 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 LogoutPageUrl property. The default is to refresh the current page.
Note: |
|---|
When a user uses the LoginStatus control to log out of a Web site, all data present in view state and all post data is lost. |
Accessibility
The markup rendered by default for this control might not conform to accessibility standards such as the Web Content Accessibility Guidelines 1.0 (WCAG) priority 1 guidelines. For details about accessibility support for this control, see ASP.NET Controls and Accessibility.
| Topic | Location |
|---|---|
| How to: Add a Login Button to an ASP.NET Web Page | Building ASP .NET Web Applications |
| How to: Add a Login Button to an ASP.NET Web Page | Building ASP .NET Web Applications |
| Walkthrough: Managing Web Site Users with Roles | Building ASP .NET Web Applications in Visual Studio |
- AspNetHostingPermission
for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission
for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.
System.Web.UI::Control
System.Web.UI.WebControls::WebControl
System.Web.UI.WebControls::CompositeControl
System.Web.UI.WebControls::LoginStatus
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note: