I have implemented FBA (Claim based Authentication) on Sharepoint 2010. Following are implemented.
- Custom Login page
- Custom Sign-in Page
- Password recovery page (ForgetPassword.aspx)
In ForgetPassword page user is asked to enter their email address, they used while sign-in and in code behind I am using this email to get the UserName using the Membership.GetUserNameByEmail function and then passing this username to Membership.GetUser function to get the user credential to be send through mail.
But now the code throws as exception saying “The function is not implemented”. I am wondering; I am not using any custom database for which I had to create a Custom Membership Provider. Then why I am getting this error. Let me know if anyone has any clue or faced similar problem. Thanks.
Regards,
Paddy
When FBA is configured for SharePoint 2010, two membership providers are defined in the
web.configfile –Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider(usually named i) andSystem.Web.Security.SqlMembershipProvider(named FBAMembership in this case). Default membership provider must be set to the former (i.e. SharePoint claims one) in order for FBA authentication to work properly.When the line containing
Membership.GetUserNameByEmail(...)is executed, the default membership provider is used and as a resultSPClaimsAuthMembershipProvider.GetUserNameByEmailis called. MSDN says that this method is reserved for internal use and is not intended to be used directly from your code and according to the comment in the Community Content section it throwsNotImplementedException.You need to retrieve an instance of the
SqlMembershipProviderprovider from theMembership.Providerscollection and then call theGetUserNameByEmailmethod using this instance.I use prefixes when configuring providers in the
web.configfile and the retrieve them like this: