Quantcast
Channel: Brian Pedersen's Sitecore and .NET Blog
Viewing all articles
Browse latest Browse all 286

Sitecore separate users from CORE database – move membership provider to separate database

$
0
0

Since Sitecore 6, Sitecore have had the .NET membership tables in the CORE database. And since every instance of Sitecore needs access to the CORE database, it might seem as a good place to store them.

But separating the users from the CORE database will make upgrades easier, as you can have 2 instances of Sitecore running without disturbing user access. You also have more scalability options when separating the two.

The separation is easy:

STEP 1: MAKE A COPY OF THE CORE DATABASE

Get yourself a copy of your CORE database. Name the new database something user-membership-like, for example “Users“.

Never mind the Sitecore tables in the newly copied database. Unless you are in need of disk space, you can leave them. They will never be used.

STEP 2: ADD A CONNECTION STRING TO THE CONNECTIONSTRINGS.CONFIG FILE

In /App_Config/ConnectionStrings.Config, add a new connection string to your “Users” database:

<add name="Users" 
   connectionString="user id=*****;password=*****;Data Source=*****;Database=Users" />

STEP 3: MODIFY WEB.CONFIG

In the web.config, find the “membership“, “rolemanager” and “profile” sections, and modify the “connectionStringName” property from “core” to “Users“:

<membership defaultProvider="sitecore" hashAlgorithmType="SHA1">
  <providers>
    <clear />
    <add name="sitecore" type="Sitecore.Security.SitecoreMembershipProvider, Sitecore.Kernel" realProviderName="sql" providerWildcard="%" raiseEvents="true" />
    <add name="sql" type="System.Web.Security.SqlMembershipProvider" connectionStringName="Users" applicationName="sitecore" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" />
    <add name="switcher" type="Sitecore.Security.SwitchingMembershipProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/membership" />
  </providers>
</membership>
<roleManager defaultProvider="sitecore" enabled="true">
  <providers>
    <clear />
    <add name="sitecore" type="Sitecore.Security.SitecoreRoleProvider, Sitecore.Kernel" realProviderName="sql" raiseEvents="true" />
    <add name="sql" type="System.Web.Security.SqlRoleProvider" connectionStringName="Users" applicationName="sitecore" />
    <add name="switcher" type="Sitecore.Security.SwitchingRoleProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/roleManager" />
  </providers>
</roleManager>
<profile defaultProvider="sql" enabled="true" inherits="Sitecore.Security.UserProfile, Sitecore.Kernel">
  <providers>
    <clear />
    <add name="sql" type="System.Web.Profile.SqlProfileProvider" connectionStringName="Users" applicationName="sitecore" />
    <add name="switcher" type="Sitecore.Security.SwitchingProfileProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/profile" />
  </providers>
  <properties>
    <clear />
    <add type="System.String" name="SC_UserData" />
  </properties>
</profile>

MORE TO READ:

 



Viewing all articles
Browse latest Browse all 286

Trending Articles