LoginView.AnonymousTemplate Property
Assembly: System.Web (in system.web.dll)
[TemplateContainerAttribute(typeof(LoginView))] public virtual ITemplate AnonymousTemplate { get; set; }
/** @property */ public ITemplate get_AnonymousTemplate () /** @property */ public void set_AnonymousTemplate (ITemplate value)
public function get AnonymousTemplate () : ITemplate public function set AnonymousTemplate (value : ITemplate)
Property Value
The ITemplate to display.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 a null reference (Nothing in Visual Basic).
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.
| Topic | Location |
|---|---|
| How to: Display Different Information to Anonymous and Logged-in Users | Building ASP .NET Web Applications |
| How to: Display Different Information to Anonymous and Logged-in Users | Building ASP .NET Web Applications |
| How to: Display Different Information to Anonymous and Logged In Users (Visual Studio) | Building ASP .NET Web Applications in Visual Studio |
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> <BODY> <FORM runat="server"> <table align="center" width="300px" bgcolor="#fffacd"> <tr bgcolor="#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" TextFormat="Welcome {0}"> </asp:LoginName> </td> <td> <a href="manageAccount.aspx">Edit info...</a> </td> </tr> <tr> <td colspan="2"> * Check e-mail * Add a link * Local weather * </td> </tr> </LoggedInTemplate> </asp:LoginView> </table> </FORM> </BODY> </HTML>
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.