SharePoint 2010 Forms Authentication Migration (For Developers)

For IT Pros, it is simple to setup the Forms Auth in SharePoint 2010.  However, when a system is migrated to 2010 that uses the Membership Provider generic factory classes extensively…all hell breaks loose!  The class definition for the Membership provider and MembershipUser is here.  After looking at that, consider a piece of code such as:

MembershipUser.ResetPassword("oldpassword", "newpassword");

The default membership provider set in SharePoint 2010 is  "Microsoft.SharePoint.Claims.SPClaimsAuthMembershipProvider".  The main job of this provider is to play an aggregation patten.  Find all username in all available providers and allow you to select them.  It also does some mapping of those users from the internal formats to a human readable format in the SharePoint web sites.  This particular membership provider as advanced as it is…DOES NOT IMPLEMENT ALL THE METHODS OF THE MEMBERSHIP PROVIDER MODELS!

This means if you used the membership methods extensively in your code (forms and web parts) in 2007, it is NOT going to work in 2010 when you migrate!  You will get several different errors around method not implementing and good luck with getting everything to work.  You will need to update your code to specifically call and instanate an instance of the membership providers that have been loaded in the process.  Such as:

MembershipProvider prov = Membership.Providers["AspNetSqlMembershipProvider"]

From there, you would then make the appropriate calls in your forms and web parts using the defined provider variable.

Good luck with the code migration!  And reference my other blog about other forms based auth migration issues here!
Chris