Export (0) Print
Expand All

LoginStatus Class

Note: This class is new in the .NET Framework version 2.0.

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

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

[BindableAttribute(false)] 
public class LoginStatus : CompositeControl
/** @attribute BindableAttribute(false) */ 
public class LoginStatus extends CompositeControl
BindableAttribute(false) 
public class LoginStatus extends CompositeControl

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.

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.

NoteNote

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.

TopicLocation
How to: Add a Login Button to an ASP.NET Web PageBuilding ASP .NET Web Applications
How to: Add a Login Button to an ASP.NET Web PageBuilding ASP .NET Web Applications
Walkthrough: Managing Web Site Users with RolesBuilding ASP .NET Web Applications in Visual Studio

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft