ToolBox Login Control LoginView

LoginView Web Server Control

in ASP.NET environment,This article describes you how to work with LoginView Web Control.The LoginView Control can Display the suitable content template for a given user, based on the user's authentication status and role membership.Moreover, which can be displaying different suitable templates for the different users.

Template Properties
  • AnonymousTemplate - Specifies the template to display to users who are not logged in to the Web site. Users who are logged in will never see this template.
  • LoggedInTemplate - Specifies the default template to display to users who are logged in to the Web site but do not belong to any role groups with defined templates.
  • RoleGroups -Specifies the template to display to logged-in users who are members of roles with defined role-group templates. Content templates are associated with particular sets of roles in RoleGroup instances.

The following code example explains how to work with 3 template of the LoginView control.

<html>
<body>
    <form id="FORM2" runat="server">
<p>
    <asp:LoginStatus ID="LoginStatus1" runat="server"></asp:LoginStatus>
</p>
<p>
    <asp:LoginView ID="lv1" runat="server">
        <AnonymousTemplate>
            log in.
        </AnonymousTemplate>
        <LoggedInTemplate>
            Thanks for logging in
            <asp:LoginName ID="ln1" runat="Server"></asp:LoginName>
            .
        </LoggedInTemplate>
        <RoleGroups>
            <asp:RoleGroup Roles="Admin">
                <ContentTemplate>
                    <asp:LoginName ID="ln2" runat="Server"></asp:LoginName>
                    , you have logged.
                </ContentTemplate>
            </asp:RoleGroup>
        </RoleGroups>
    </asp:LoginView>
</p>
    </form>
</body>
</html>                    
                    
 
Related Links