Search

Jul 14, 2008

LoginView Control provided by .NET 2.0

Its general prectices where we have to show some different layout when user is anonymous and different layout when user is authorized.

The .NET 2.0 provides the inbuild control, asp:LoginView; it will allow you to define the two different tamplets, one for anonymouse and another is for authorized user. Also it provides the the RoleGroups; using this you can also devide your authorized user template to one step down, means we can define the template based on Role too.

Here is the common template of asp:LoginView

<asp:LoginView runat="server" ID="loginView">
<AnonymousTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="top-menu">
<a href="#" title="">Login</a>
</td>
</tr>
</table>
</AnonymousTemplate>
<LoggedInTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="top-menu">
<a href="#" title="">Home</a>
<a href="#" title="">Change Password</a>
<a href="#" title="">Logout</a>
</td>
</tr>
</table>
</LoggedInTemplate>
</asp:LoginView>

No comments: