By adding Loginview Controls display different information to anonymous users and login (authenticated) users. Loginview The control contains two templates: one for displaying information to anonymous users and the other for displaying information to logged-on users. (You can also use Rolegroups The attribute contains a template based on the role name .) The control automatically determines whether the user is authenticated and displays the corresponding template.
1 , in Asp. net in the" design "view of the page, select a loginview drag the control to the page.
2 If" Loginview If the task panel is not displayed, right-click the control and Click Show Smart tag to display Loginview Task panel. By default, this control displays Anonymoustemplate .
3 Add static text and controls visible to Unlogged users, for example, it is used to log on to a user, restore the password, or create a new user id login control.
4 , in" loginview task" menu, select loggedintemplate .
5 Add static text and controls visible to authenticated users, for example, formatstring set the property to the loginname control.
<Asp: loginview id = "loginview1" runat = "server">
<Loggedintemplate>
<Asp: loginname id = "loginname1" runat = "server"
Formatstring = "Welcome, {0}"/>
<Br/>
<Asp: hyperlink id = "hyperlink1" runat = "server"
Navigateurl = "~ /Memberpages/changepassword. aspx ">
Change Password
</ASP: hyperlink>
</Loggedintemplate>
<Anonymoustemplate>
<Asp: Login ID = "login1" runat = "server"
Createusertext = "Create a new user ..."
Createuserurl = "~ /Register. aspx"
Passwordrecoveryurl = "~ /Recovery. aspx"
Usernamelabeltext = "E-mail address:"/>
</Anonymoustemplate>
</ASP: loginview>
TheCodeFor example Anonymoustemplate And Loggedintemplate In the "Source" view Loginview Control.