LoginView.LoggedInTemplate Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene o establece la plantilla que se ha de mostrar a usuarios del sitio Web que, pese a haber iniciado una sesión en él, no sean miembros de uno de los grupos de roles especificados en la propiedad RoleGroups.
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
Valor de propiedad
ITemplate que se va a mostrar.
- Atributos
Ejemplos
En el ejemplo de código siguiente se usa la LoggedInTemplate plantilla para mostrar vínculos a información personalizada para los usuarios que han iniciado sesión.
<%@ 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>
Comentarios
La LoggedInTemplate propiedad se muestra a los usuarios del sitio web cuando se cumplen las dos condiciones siguientes:
El usuario no pertenece a un grupo de roles definido en la RoleGroups propiedad .
La LoggedInTemplate propiedad especifica una plantilla predeterminada para los usuarios de sitios web autenticados. Si no ha configurado la administración de roles, es LoggedInTemplate la única plantilla disponible para los usuarios autenticados. Para obtener más información sobre cómo configurar la administración de roles, consulte Descripción de la administración de roles.