Providing a Login-Logout link

Learning Resources
 

Providing a Login-Logout link


To create a registration link on the home page

  • Switch to or open the Default.aspx page.
  • Right-click the LoginView control that you added previously, and then click Show Smart Tag.
  • In the LoginView Tasks panel, select AnonymousTemplate from the Views list in order to activate editing in the anonymous template.
  • From the Standard group of the Toolbox, drag a HyperLink control into the anonymous template. It might be easier to put the cursor in the editing area and double-click the HyperLink control in the Toolbox.
  • In the Properties window for the HyperLink control, do the following:
    •     Set the Text property to Register.
    •     Set the NavigateUrl property to Register.aspx.
  • Switch to or open the Login.aspx page.
  • From the Standard group of the Toolbox, drag a HyperLinkcontrol into the page.
  • In the Properties window for the HyperLinkcontrol, do the following:
    •     Set the Text property to Register.
    •     Set the NavigateUrl property to Register.aspx.

To test registration

  • Switch to the Default.aspx page and press CTRL+F5 to run the Web site and display the Default.aspx page. Because you are not logged in, the Register link is displayed.
  • Click the Register link. The registration page is displayed.
  • In the boxes, enter a new user name, a strong password, an email address, and a security question and answer. (All the pieces of information are required.)
  • Click Create User. A confirmation message is displayed.
  • Click Continue. You are returned to the home page as a logged-in user. Note that the Login link has changed to Logout and that the information displayed in the Login control is from the LoggedInTemplate property, not from the AnonymousTemplate property.
  • Click the Logout link.The page changes to display the information for anonymous users.
  • Click the Login link.
  • Enter the credentials for the user you just created.You are logged in as the new user.
  • Close the browser window.
--Microsoft
 For Support