The Login Status control displays a login link for users who are not authenticated and a logout link for users who are authenticated. The login link takes the user to a login page. The logout link resets the current user's identity to be an anonymous user.

You can customize the appearance of the Login Status control by setting the Login Text and Login Image Url properties. The login link automatically redirects to the configured login page, and the logout link automatically calls the method Form Authentication. Sign Out for logging off the user.

<asp:LoginStatus ID="LoginStatus1" runat="server"
LoginText="Sign In"
LogoutText="Sign Out"
LogoutPageUrl="~/Default.aspx"
LogoutAction="Redirect"
onloggedout="LoginStatus1_LoggedOut" />

Login Status control properties:

In my attached sample I am redirecting to new page after login. If login is successfully then will redirect to new page and you can see new link Sign Out.

This is login Page.

Image1.jpg

Figure 1

After successfully login it redirect to Login Status page. If user is authenticated the Sign Out link should be enable else Sign In link should be enable

Image2.jpg

Figure 2

If you click on Sign Out, it redirects to Login Page.