LoginView.AnonymousTemplate Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the template to display to users who are not logged in to the Web site.
public:
virtual property System::Web::UI::ITemplate ^ AnonymousTemplate { 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 AnonymousTemplate { 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.AnonymousTemplate : System.Web.UI.ITemplate with get, set
Public Overridable Property AnonymousTemplate As ITemplate
Property Value
The ITemplate to display.
- Attributes
Examples
The following code example uses the template specified in the AnonymousTemplate template to display an invitation to sign up for personalized services.
<%@ 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>
Remarks
The AnonymousTemplate property specifies the content template to display to Web site users when they are not logged in to the Web site. This template is displayed when the Name property of the PageUser property is null
.
The AnonymousTemplate template is never displayed to authenticated users. If the AnonymousTemplate property is empty, no content is displayed to users who are not logged in.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기