Learning Resources
 

Creating the Password Recovery page


To create a link to the change-password page

  1. In Solution Explorer, double-click the Site.master page and switch to Design view.

  2. From the Standard node of the Toolbox, drag a Hyperlink control to the master page and drop it next to the Log In hyperlink.

    For this part of the walkthrough, it does not matter where you put the Hyperlink control.

  3. In the Properties windows, change the Text property to Change Password. You can accept the default ID.

  4. In the Properties window, click NavigateUrl and click the ellipsis (...) button.

    The Select URL dialog box is displayed.

  5. Under Project folders, click Account.

  6. Under Contents of folder, select ChangePassword.aspx and then click OK.

  7. Press CTRL+F5 to run the page.

    Notice that the Change Password link is accessible when you are not logged in.

  8. Click Change Password.

    You are redirected to the login page because the change-password page is accessible to authenticated users only.

  9. Enter the user name and password that you created earlier, and then click Log In.

    The change-password page is displayed.

  10. Click Log Out.

  11. When you are returned to the home page, close the browser.

Next, you will modify the Change Password hyperlink to make it accessible only to users are logged in. You do this by adding the hyperlink to the HeadLoginView control on the master page.

To make the change-password link available only to logged-in users

  1. In Solution Explorer, double-click Site.master.aspx to open it, and then switch to Design view.

  2. Delete the Change Password hyperlink that you created earlier.

  3. Switch to Source view.

  4. From the Standard node of the Toolbox, drag a HyperLink control into the LoggedInTemplate element that is inside the LoginView control.

  5. Set the Text property to Change Password.

  6. After the runat="server" attribute, type "NavigateUrl=" and then double-click Pick URL… from the pop-up list.

    The Select Project Item dialog box is displayed.

  7. Under Project folders, click Account.

  8. Under Contents folder, select ChangePassword.aspx and then click OK.

    The markup for the hyperlink will resemble the following:

    
      Change Password
    
    

 

--Microsoft