Redigeeri

Jagamisviis:


Login.VisibleWhenLoggedIn Property

Definition

Gets or sets a value indicating whether to show the Login control after the user is authenticated.

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

Property Value

false if the Login control should be hidden when the user is authenticated; otherwise, true. The default is true.

Attributes

Examples

The following code example sets the VisibleWhenLoggedIn property to true to specify that the Login control is not hidden and is always displayed on the page, regardless of whether the user has been authenticated.

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

Remarks

The VisibleWhenLoggedIn property specifies whether the Login control is displayed to authenticated users. When the property is false, the Login control does not appear on the page when an authenticated user accesses the site. This is used on Web pages that are used both as login pages and as information pages to hide the Login control after the user has been authenticated.

The VisibleWhenLoggedIn property has no effect on a Login control that appears on the default login page defined in Web.config or in the application's configuration file.

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