Using the LoginStatus and LoginName Controls
Now we have a login page we can use the LoginStatus
and LoginName
controls to provide the additional membership-related functionality in our templates. Let's go ahead and add these controls to our master page.
1. Open
TropicalGreen.master
in Design view.2. From the Login tab of the toolbox, drag a LoginStatus control to the right-hand table cell above the existing menu control (MenuRight).
3. Click the
LoginStatus
control (LoginStatus1) and the events icon in the Property window.4. Double-click the LoggedOut event to add the
Login1_LoggedOut
event handler and jump to it in Code view.5. Add the following
using
statement:using Microsoft.ContentManagement.Web.Security;
6. Implement the following directly beneath the
Page_Load
method:protected void LoginStatus1_LoggedOut(object sender, EventArgs e) { CmsFormsAuthentication.SignOut(); }
7. Save your work, and from the Build menu, choose Build Web Site.
We can now test the LoginStatus
control by...