Learning Resources
 

Implementing Registration and Login


To create a registration page

  1. In Solution Explorer, right-click the name of the Web site project and then click Add New Item.

  2. Add a new Web Form named Register.aspx and click Add.

    Note Note

    Make sure that you create the page in the root of the Web site, not in the MemberPages folder.

  3. In the Register.aspx page, switch to Design view and enter text such as Register into the page. In the Formatting toolbar, use the Block Format drop-down list to format the text as Heading 1.

  4. From the Login group of the Toolbox, drag a CreateUserWizard control onto the page.

  5. In the Properties window for the CreateUserWizard control, set the ContinueDestinationPageUrl property to ~/Default.aspx.

    This configures the control so that when users click Continue after they create a user, they are returned to the home page.

  6. From the Standard group of the Toolbox, drag a HyperLink control onto the page.

  7. In the Properties window for the HyperLink control, do the following:

    • Set the Text property to Home.

    • Set the NavigateUrl property to ~/Default.aspx.

  8. Save and close the page.

You will now add a link that displays the registration page to both the home page and the Login page. For this walkthrough, assume that you want to display the registration link only to users who are not logged in.

To create a registration link on the home page

  1. Switch to or open the Default.aspx page.

  2. Right-click the LoginView control that you added previously, and then click Show Smart Tag.

  3. In the LoginView Tasks panel, select AnonymousTemplate from the Views list in order to activate editing in the anonymous template.

  4. 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.

  5. In the Properties window for the HyperLink control, do the following:

    1. Set the Text property to Register.

    2. Set the NavigateUrl property to Register.aspx.

  6. Switch to or open the Login.aspx page.

  7. From the Standard group of the Toolbox, drag a HyperLinkcontrol into the page.

  8. In the Properties window for the HyperLinkcontrol, do the following:

    You can now test the registration process.

    1. Set the Text property to Register.

    2. Set the NavigateUrl property to Register.aspx.

 

--Microsoft