Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

6. Authentication Controls and Membershi... > Implementing an MCMS Membership Prov...

Implementing an MCMS Membership Provider

In order to support MCMS applications, our MCMS Membership Provider has to implement the ValidateUser()method, which performs MCMS Forms Authentication. This is the method that will be called when a user submits his or her credentials from the Login control. The following example shows such an implementation:

public override bool ValidateUser(string strUsername,
Membership ProviderForms Authenticationstring strPassword)
{
bool ValidUser = false;
CmsAuthenticationTicket Ticket =
CmsFormsAuthentication.AuthenticateAsUser(strUsername,
strPassword);
if (Ticket != null)
{
ValidUser = true;
}
return ValidUser;
}

This code will generate an MCMS authentication ticket if authentication is successful. We could now directly call the CmsFormsAuthentication.SetAuthCookie to set the cookie, but the provider is not the right place to set the cookie. The ValidateUser() method should only verify if the user credentials provided are valid. In the provider, we would also not have access to the properties of the Login control, like the RememberMeSet checkbox, which gives the user the opportunity to decide whether the cookie should be persisted.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint