System.Web 2.0.0.0 System.Web.UI.WebControls.CompositeControl 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)

In this topic:

Introduction

Declarative Syntax

## Introduction

The control has two states, logged in to the Web site and logged out of the Web site, determined by the property of the object's property.

The control displays either a text or an image link, depending on the setting of the and 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 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 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 control will display the prompt to log in.

The logout behavior is controlled by the 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 property. The default is to refresh the current page.

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

## Declarative Syntax

`<asp:LoginStatus AccessKey="string" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset" BorderWidth="size" CssClass="string" Enabled="True|False" EnableTheming="True|False" EnableViewState="True|False" Font-Bold="True|False" Font-Italic="True|False" Font-Names="string" Font-Overline="True|False" Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| Large|X-Large|XX-Large" Font-Strikeout="True|False" Font-Underline="True|False" ForeColor="color name|#dddddd" Height="size" ID="string" LoginImageUrl="uri" LoginText="string" LogoutAction="Refresh|Redirect|RedirectToLoginPage" LogoutImageUrl="uri" LogoutPageUrl="uri" LogoutText="string" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnLoggedOut="LoggedOut event handler" OnLoggingOut="LoggingOut event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" Style="string" TabIndex="integer" ToolTip="string" Visible="True|False" Width="size" />`

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

- Constructor
  To be added.

  Initializes a new instance of the class.

  2.0.0.0
- Method
  2.0.0.0
  System.Void

  This member is used primarily by control developers when deriving a custom control from the class.

  This method is called by the ASP.NET infrastructure to notify any controls that use composition-based implementation, including controls that derive from and , to create any child controls they contain in preparation for postback or rendering.

  Creates the child controls that make up the control.

- Event
  System.EventHandler

  The event is raised on the server after the user clicks the logout link and the logout process is complete.

  When the user clicks the logout link, the event is raised, then the logout process is run, and finally the event is raised.

  Use the event to provide additional processing such as cleaning up database connections or removing per-user cached data after the user logs out of a Web site. The user's identity is still available while the event is executing. If your handler for the event redirects the client browser to another page, the authentication cookie will be cleared from the client.

  Raised after the user clicks the logout link and the logout process is complete.

  2.0.0.0
- Event
  System.Web.UI.WebControls.LoginCancelEventHandler

  The event is raised on the server when the user clicks the logout link. The logout process does not occur until after this event, and user information is still available.

  The event allows you to cancel the logout process if the user must complete an activity before leaving the Web site, such as purchasing items in a shopping cart or submitting changes to a database. You can cancel the event by setting the property of the parameter to true.

  Use the event to provide additional processing, such as clearing per-user data, before a user logs out of a site.

  Raised when the user clicks the logout button.

  2.0.0.0
- Property
  System.Web.UI.UrlProperty
  System.ComponentModel.Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  The property contains the location of the image used for the login link. The property is used as the alternative text for the image.

  If is empty, the property is rendered as the link.

  Gets or sets the URL of the image used for the login link.

  2.0.0.0
- Property
  System.ComponentModel.Localizable(true)
  System.String To be added.

  The property is displayed as the link text when the property is empty.

  When the property contains a link, the property is used as the alternative text for the image.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Gets or sets the text used for the login link.

  2.0.0.0
- Property
  System.Web.UI.Themeable(false)
  System.ComponentModel.DefaultValue(System.Web.UI.WebControls.LogoutAction.Refresh)
  System.Web.UI.WebControls.LogoutAction To be added.

  The property determines which page is presented to the user when he or she logs out using the control.

  The following table describes the actions taken for each value.

  value

  Action taken

  Redirects the user to the URL contained in the property. If is empty, the user is redirected to the login page defined in the application configuration settings.

  Redirects the user to the login page defined in the application configuration settings.

  Refreshes the current page.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets a value that determines the action taken when a user logs out of a Web site with the control.

  2.0.0.0
- Property
  System.Web.UI.UrlProperty
  System.ComponentModel.Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  The property contains the location of the image used for the logout link. The property is used as the alternative text for the image in browsers.

  If is empty, the property is rendered as the link.

  Gets or sets the URL of the image used for the logout button.

  2.0.0.0
- Property
  System.Web.UI.UrlProperty
  System.Web.UI.Themeable(false)
  System.ComponentModel.Editor("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  When the property is set to , the user is redirected to the URL contained in .

  If is set to any other value, the contents of the property are ignored.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the URL of the logout page.

  2.0.0.0
- Property
  System.ComponentModel.Localizable(true)
  System.String To be added.

  The property is displayed when the property is empty.

  When the property contains a link, the property is used as the alternative text for the image in browsers that do not support images.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Gets or sets the text used for the logout link.

  2.0.0.0
- Method
  System.Void ``

  Use the event to provide additional processing, such as closing database connections or cleaning up per-user cached data, after the user has logged out of a Web site.

  For more information about handling events, see Consuming Events. Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event after the user clicks the logout link and logout processing is complete.

  An that contains the event data. 2.0.0.0
- Method
  System.Void ``

  Use the event to provide additional processing, such as cleaning up per-user data, before a user logs out of a site. The event can be canceled, so you can give the user the option of saving data such as a shopping cart or database changes before leaving the Web site.

  For more information about handling events, see Events and Delegates.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event when a user clicks the logout link on the control.

  A that contains event data. 2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  The method determines whether the user is logged in by examining the property of the object's property. If the user is logged in, the or property is used to render the control. If the user is not logged in, the or property is used to render the control.

  For more information about handling events, see Events and Delegates.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Determines whether a user is logged in, and gets the URL of the login page.

  An containing the event data.
- Method
  2.0.0.0
  System.Void `` To be added.

  Renders the control to the specified control.

  A object that represents the output stream that renders HTML content to the client.
- Method
  2.0.0.0
  System.Void `` To be added.

  Renders the contents of the control to the specified writer. This method is used primarily by control developers.

  A object that represents the output stream that renders HTML content to the client.
- Method
  System.Void `` To be added.

  Overrides the base method.

  An containing the state of the control. 2.0.0.0
- Property
  System.Web.UI.HtmlTextWriterTag To be added.

  The property allows the output stream to write the appropriate HTML markup for the control. The property is used primarily by control developers.

  Gets the value for the control.

  2.0.0.0