SP2010: Cannot get membership provider with name…
Today I was yet again playing around with SharePoint 2010 which is RTM now! I’ve downloaded the RTM version from MSDN and installed it on my workstation. Earlier, I had some problems setting up a claims based authentication site with mixed mode authentication (windows + forms auth). I wanted to try that in the RTM version, so I setup a claims based site.
One of the options i noticed is ‘Custom Login Page’. I need a custom page for a project i’ll be doing, so I was interested in this! After some investigation, I found out that the default claims login page is found in c:\inetpub\wwwroot\wss\VirtualDirectories\site\_forms\Default.aspx. This page is only available when you’ve got claims based authentication setup. Since this page is overwritten with the default (located in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IDENTITYMODEL\FORMS), modifying it isn’t a good idea. You can however make a copy of it which you can modify.
Just for testing purposes, I copied the file as CustomLogin.aspx and set the custom login page URL in the site auth setup to “/_forms/CustomLogin.aspx”. Navigated to the page and there was my custom login page!
I then tried one of my FBA accounts, but an error occurred: “Cannot get Membership Provider with name xyz. The membership provider for this process was not properly configured. You must configure the membership provider in the .config file for every SharePoint process.”
Weird, I had setup the site to have the correct membership providers in web.config and it was working fine, so what was going on? I started searching and found some service called ‘SecurityTokenServiceApplication’. Since the SharePoint log was telling me it couldn’t get a valid security token, I assumed that may have something to do with it. And it did!
The SecurityTokenApplicationService is found at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken. There’s a web.config file which you can edit. Add your membership providers and you’re good to go. I’m not sure whether this is best practice (editing files in the 14 hyve usually isn’t), but for now it’s the only solution I could find. Needless to say that you do need administrator access to your SharePoint server if you want to do this, so this isn’t going to work in SharePoint Online scenarios.