LoginView.LoggedInTemplate Özellik

Tanım

Web sitesinde oturum açmış ancak özelliğinde belirtilen RoleGroups rol gruplarından birinin üyesi olmayan Web sitesi kullanıcılarına görüntülenecek şablonu alır veya ayarlar.

public:
 virtual property System::Web::UI::ITemplate ^ LoggedInTemplate { System::Web::UI::ITemplate ^ get(); void set(System::Web::UI::ITemplate ^ value); };
[System.ComponentModel.Browsable(false)]
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
[System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.LoginView))]
public virtual System.Web.UI.ITemplate LoggedInTemplate { get; set; }
[<System.ComponentModel.Browsable(false)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
[<System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.LoginView))>]
member this.LoggedInTemplate : System.Web.UI.ITemplate with get, set
Public Overridable Property LoggedInTemplate As ITemplate

Özellik Değeri

ITemplate

ITemplate Görüntülenecek.

Öznitelikler

Örnekler

Aşağıdaki kod örneği, oturum açan kullanıcılar için kişiselleştirilmiş bilgilerin bağlantılarını görüntülemek için şablonu kullanır LoggedInTemplate .

<%@ 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">
            <table style="text-align:center; width:300px; background-color:#fffacd">
                <tr style="background-color:#dcdcdc">
                    <td>Personal content</td>
                    <td>
                        <asp:LoginStatus id="LoginStatus1" runat="Server"></asp:LoginStatus>
                    </td>
                </tr>
                <asp:LoginView id="LoginView1" runat="server">
                    <AnonymousTemplate>
                        <tr>
                            <td colspan="2">
                                <a href="createUser.aspx">Sign up</a> to personalize your account.
                            </td>
                        </tr>
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        <tr>
                            <td>
                                <asp:LoginName id="LoginName1" runat="Server" 
                                    FormatString="Welcome {0}">
                                </asp:LoginName>
                            </td>
                            <td>
                                <a href="manageAccount.aspx">Edit info...</a>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                * Check email * Add a link * Local weather *
                            </td>
                        </tr>
                    </LoggedInTemplate>
                </asp:LoginView>
            </table>
        </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">
            <table style="text-align:center; width:300px; background-color:#fffacd">
                <tr style="background-color:#dcdcdc">
                    <td>Personal content</td>
                    <td align="right">
                        <asp:LoginStatus id="LoginStatus1" runat="Server"></asp:LoginStatus>
                    </td>
                </tr>
                <asp:LoginView id="LoginView1" runat="server">
                    <AnonymousTemplate>
                        <tr>
                            <td colspan="2">
                                <a href="createUser.aspx">Sign up</a> to personalize your account.
                            </td>
                        </tr>
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        <tr>
                            <td>
                                <asp:LoginName id="LoginName1" runat="Server" 
                                    FormatString="Welcome {0}">
                                </asp:LoginName>
                            </td>
                            <td align="right">
                                <a href="manageAccount.aspx">Edit info...</a>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                * Check email * Add a link * Local weather *
                            </td>
                        </tr>
                    </LoggedInTemplate>
                </asp:LoginView>
            </table>
        </form>
    </body>
</html>

Açıklamalar

Özellik LoggedInTemplate , aşağıdaki koşulların her ikisi de karşılandığında Web sitesi kullanıcılarına görüntülenir:

  • Name Özelliğin PageUser özelliğinull

  • Kullanıcı özelliğinde tanımlanan bir rol grubuna RoleGroups ait değil.

LoggedInTemplate özelliği, kimliği doğrulanmış Web sitesi kullanıcıları için varsayılan bir şablon belirtir. Rol yönetimini yapılandırmadıysanız, LoggedInTemplate kimliği doğrulanmış kullanıcılar için kullanılabilen tek şablondur. Rol yönetimini yapılandırma hakkında daha fazla bilgi için bkz. Rol Yönetimini Anlama.

Şunlara uygulanır

Ayrıca bkz.