Check out my new blog at https://shibumiware.blogspot.com

Wednesday, April 02, 2014

Forms Authentication in SharePoint

There are tons of posts about how to configure forms auth for SharePoint.  I have a need for a forms auth site collection so I started off by reading the office documentation from Microsoft.  After configuring the web application and creating a new site collection (and doing the numerous things you must do before this), I attempted to browse the new site collection.  I got this error:

“Cannot get Membership Provider with name AspNetSqlMembershipProvider. The membership provider for this process was not properly configured. You must configure the membership provider in the .config file for every SharePoint process.”

Okay, so I went to Central Admin->Security->Specify -->Authentication Providers—>Default and noted that AspNetSqlMembershipProvider was specified.  I checked the web.config and it was listed (inherited).  Reset IIS.  No luck.

Ah, but wait, the security token service wasn’t started.  That must be it.  So I started the service and still no luck.

In IIS Manager, I noticed this:

 image

That doesn’t look right.  The AspNetSqlMembershipProvider is not listed.

Here is what the problem is:

Open :C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\Root\web.config

Notice this:

system.web>
    <membership defaultProvider="i">
      <providers>
        <clear />
        <add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
      </providers>
    </membership>
    <roleManager enabled="true" defaultProvider="c">
      <providers>
        <clear />
        <add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
      </providers>
    </roleManager>
  </system.web>

The <clear /> element is well understood of course.  It simply clears all inherited providers in this case.  Removing those two elements and here we go:

image

The next problem is trying to create users.  When I open the .NET Users feature I get: “The default role provider does not exist”.

In web.config change:

<roleManager cacheRolesInCookie="false" defaultProvider="c" enabled="true">

to:

<roleManager cacheRolesInCookie="false" defaultProvider="AspNetSqlRoleProvider" enabled="true">

I created a users and logged in just fine.

I feel tool coming on for configuring all of this without wading through XML.

Hope this helps.

No comments :

Disclaimer

Content on this site is provided "AS IS" with no warranties and confers no rights. Additionally, all content on this site is my own personal opinion and does not represent my employer's view in any way.