This documentation is archived and is not being maintained.

LoginView.LoggedInTemplate Property

Gets or sets the template to display to Web site users who are logged in to the Web site but are not members of one of the role groups specified in the RoleGroups property.

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

public virtual ITemplate LoggedInTemplate { get; set; }

Property Value

Type: System.Web.UI.ITemplate
The ITemplate to display.

The LoggedInTemplate property is displayed to Web site users when both of the following conditions are met:

  • The Name property of the Page User property is not null

  • The user does not belong to a role group defined in the RoleGroups property.

The LoggedInTemplate property specifies a default template for authenticated Web site users. If you have not configured role management, the LoggedInTemplate is the only template available for authenticated users. For more information about configuring role management, see Understanding Role Management.

The following code example uses the LoggedInTemplate template to display links to personalized information for logged-in users.

<%@ Page Language="C#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<script runat="server">
<html xmlns="" >
    <head runat="server">
    <title>ASP.NET Example</title>
        <form id="form1" runat="server">
            <table style="text-align:center; width:300px; background-color:#fffacd">
                <tr style="background-color:#dcdcdc">
                    <td>Personal content</td>
                        <asp:LoginStatus id="LoginStatus1" runat="Server"></asp:LoginStatus>
                <asp:LoginView id="LoginView1" runat="server">
                            <td colspan="2">
                                <a href="createUser.aspx">Sign up</a> to personalize your account.
                                <asp:LoginName id="LoginName1" runat="Server" 
                                    FormatString="Welcome {0}">
                                <a href="manageAccount.aspx">Edit info...</a>
                            <td colspan="2">
                                * Check e-mail * Add a link * Local weather *

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0