cloud1230

导航

[转]Multiple SharePoint 2007 sites running off Forms Authentication

Multiple SharePoint 2007 sites running off Forms Authentication

Whether this was possible had me puzzled for a little while.

The scenario is, you want to run two WSS 3.0 (or MOSS 2007) sites of Forms Authentication, but they have different set of users and roles each. This could be typical in a hosted environment I guess.

The seperate WSS 3.0 sites and web applications themselves weren't a problem because you can put seperate connection strings, roles, and aspnetdb application names in each web.config. It was how to get Central Administration to recognise 2 seperate FBA applications so you could set the site collection administrators. I've already done plenty of FBA stuff with ASP.NET so thankfully this isn't new to me like it might be many SP administrators. Here's the stuff you need to put in central admin to get it working.

<connectionStrings>
    <add name="FBA1ConnString" connectionString="server=NickServer;database=AspNetDB;uid=sa;pwd=*****;" providerName="System.Data.SqlClient" />
    <add name="FBA2ConnString" connectionString="server=NickServer;database=AspNetDB;uid=sa;pwd=*****;" providerName="System.Data.SqlClient" />
</connectionStrings>

Having just looked at this, if you were more clever than me you could in effect just have one connection string as we're looking at the same aspnetdb

<membership defaultProvider="FBA1AspNetSqlMembershipProvider">
    <providers>
        <add name="FBA1AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        connectionStringName="FBA1ConnString"
        enablePasswordRetrieval="false"
        enablePasswordReset="true"
        requiresQuestionAndAnswer="false"
        applicationName="FBA1"
        requiresUniqueEmail="false"
        passwordFormat="Hashed"
        maxInvalidPasswordAttempts="5"
        minRequiredPasswordLength="1"
        minRequiredNonalphanumericCharacters="0"
        passwordAttemptWindow="10"
        passwordStrengthRegularExpression=""
        />

        <add name="FBA2AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        connectionStringName="FBA2ConnString"
        enablePasswordRetrieval="false"
        enablePasswordReset="true"
        requiresQuestionAndAnswer="false"
        applicationName="FBA2"
        requiresUniqueEmail="false"
        passwordFormat="Hashed"
        maxInvalidPasswordAttempts="5"
        minRequiredPasswordLength="1"
        minRequiredNonalphanumericCharacters="0"
        passwordAttemptWindow="10"
        passwordStrengthRegularExpression=""
        />

    </providers>

</membership>

<!-- role provider -->
<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider">
    <providers>
        <add name="FBA1AspNetSqlRoleProvider"
        type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        connectionStringName="FBA1ConnString"
        applicationName="/"
        />
        <add name="FBA2AspNetSqlRoleProvider"
        type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        connectionStringName="FBA2ConnString"
        applicationName="/"
        />
    </providers>
</roleManager>

For this to all make sense here are some articles I suggest reading:

http://www.wildwires.com/Blog/PermaLink,guid,2dc7ea3d-c892-4baa-b990-671e0c2ab673.aspx

http://www.chandima.net/Blog/Lists/Posts/Post.aspx?ID=6

http://www.andrewconnell.com/blog/articles/HowToConfigPublishingSiteWithDualAuthProvidersAndAnonAccess.aspx

My very old post on setting up FBA:
http://weblog.vb-tech.com/nick/archive/2006/06/14/1617.aspx

posted on 2007-05-24 17:22  It all depends on your attitude  阅读(125)  评论(0)    收藏  举报