Click here to Skip to main content
15,885,914 members
Articles / Properties
Article

LoginStatus Control

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
11 Oct 2013CPOL1 min read 15.1K   2  
LoginStatus control is used to display Login /Logout links based on the login status of the current user.If the user logged in it displays Logout ,if

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

LoginStatus control is used to display Login /Logout links based on the login status of the current user.If the user logged in it displays Logout ,if not it displays Login.

The control provides LoginText and LogoutText properties which can be used to change the rendered Text for the logged in and logged out links.

When the user clicks the login link , he/she will get redirected to Login page that is specified in  Forms configuration section in web.config file .when the user clicks the logout text , he/she became Unauthenticated and redirected to Login page .

Instead of displaying the login / logout text , you can also use its LoginImageUrl and LogoutImageUrl properties to specify the Images that will be displayed in each view.

LoginStatus has a LogoutAction property which determines the page that will be displayed when the user logout from the website by clicking the logoutText or LogoutImage.This property can take one of the following values

  • Redirect : Redirects the user to the URL contained in the LogoutPageUrl property. If LogoutPageUrl is empty, the user is redirected to the login page defined in the Forms configuration section  in web.config .
  • RedirectToLoginPage: Ignores the value of  LogoutPageUrl and redirect the user to Login page that is defined in the Forms configuration section  in web.config .
  • Refresh: just refresh the current page without any redirection.

Links:

Quick start tutorial

LoginStatus Class

LoginStatus Members

This article was originally posted at http://wiki.asp.net/page.aspx/409/loginstatus-control

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.

The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
This is a Collaborative Group

754 members

Comments and Discussions

 
-- There are no messages in this forum --