Login.DisplayRememberMe Property

Definition

Gets or sets a value indicating whether to display a check box to enable the user to control whether a persistent cookie is sent to their browser.

public:
 virtual property bool DisplayRememberMe { bool get(); void set(bool value); };
[System.Web.UI.Themeable(false)]
public virtual bool DisplayRememberMe { get; set; }
[<System.Web.UI.Themeable(false)>]
member this.DisplayRememberMe : bool with get, set
Public Overridable Property DisplayRememberMe As Boolean

Property Value

true to display the check box; otherwise, false. The default is true.

Attributes

Examples

The following code example disables the Remember Me check box by setting the DisplayRememberMe property to false.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">
            <asp:Login id="Login1" runat="server" 
                DisplayRememberMe = "False">
            </asp:Login>
        </form>
    </body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">
            <asp:Login id="Login1" runat="server" 
                DisplayRememberMe = "False">
            </asp:Login>
        </form>
    </body>
</html>

Remarks

When the DisplayRememberMe property is set to true, the text contained in the RememberMeText property is displayed on the page, along with a Remember Me check box. When the user selects the Remember Me check box, the authentication cookie sent to their computer persists so that the user is automatically authenticated on future visits to the site. The value of the RememberMeSet property is set by the selection in the Remember Me check box.

If DisplayRememberMe is false, a Remember Me check box is not displayed on the page and the user has no way to control whether the authentication cookie persists or not. You can still set the RememberMeSet property to true to send a persistent authentication cookie to the user's browser without displaying the check box.

Note

There are inherent security risks with setting a persistent authentication cookie on a user's browser. You should determine whether these security risks are acceptable to your site. If you set the RememberMeSet property to true and the DisplayRememberMe property to false, users visiting your Web site from public browsers, as in Internet cafes for example, can accidentally leave persistent authentication cookies behind and the next user of the browser will be able to access your Web site using the previous user's credentials.

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

Applies to

See also