How do I get ASP.NET login status controls to display a Log In option?
Posted
by Greg McNulty
on Stack Overflow
See other posts from Stack Overflow
or by Greg McNulty
Published on 2010-06-17T04:17:56Z
Indexed on
2010/06/17
4:23 UTC
Read the original article
Hit count: 314
I have the following log in status controls on the top of my master page. It displays the logged in as, manager log in, and Log out options.
However, when a user is not logged in, there is nothing displayed there. When the user is NOT logged in, is there a way to display a "Login" text link that takes you to the log in page and then "disappears" once the user is logged in?
Any help is appreciated. Thanks!
<asp:LoginName ID="LoginName1" runat="server" FormatString="Logged in as {0}" ForeColor="Aqua" />
<asp:LoginView ID="LoginView1" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="Managers">
<ContentTemplate>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/Management/management.aspx">Manage Site</asp:HyperLink> or
<asp:LoginStatus id="LoginStatus1" runat="server" />
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
<LoggedInTemplate>
(<asp:LoginStatus id="LoginStatus1" runat="server" />)
</LoggedInTemplate>
</asp:LoginView>
ASP.NET 3.5 VWD 2008 C#
© Stack Overflow or respective owner