4

I am currently working on migration of our customer's On-Premise infrastructure to Azure.

Website was developed by some other vendor. In Sitecore application I found that only shared Session connection string is mentioned. When I have checked session state mode. It was configured as below.

Connection string

<add name="sharedsession" connectionString="user id=user-id;password={some-pwd};Data Source=db-server;Database=Sitecore.Sessions" />

Session State

<add name="mssql" type=" Sitecore.SessionProvider.Sql.SqlSessionStateProvider, Sitecore.SessionProvider.Sql" connectionStringName="sharedsession" pollingInterval="2" compression="true" sessionType="private"/>

Currently, customer is not using any Analytics. However in near-future, it may start using that. Does this mean above session is actually 'Private" session despite being marked as shared.

What is the correct way to configure it? Should I go ahead and change sessionType as "shared" Do I need to add both shared and private session state?

Update

Will it be okay if I use same database for both Shared and Private session? I mean, let's say only one connection string with name as "sharedsession" for which I will configure session state in web.config and Sitecore.Analytics.Tracking.config patch

Environment

Sitecore v8.1 Update 2 with xDB Cloud 2 CD instances.

1 Answer 1

3

From the sitecore site:

Important You must configure both private and shared session states. You can choose to use the same session provider for both but to ensure that the system can distinguish between them you must configure the correct attribute in the web.config and the Sitecore.Analytics.Tracking.config files.

https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/xdb/session_state/session_state

To configure sql session state provider you need to follow next steps:

Add two new connection string into /Website/App_Config/ConnectionStrings.config

 <add name="session" connectionString="user id=user;password= pass;Server=server;Database=database_Session"/>

 <add name="sharedsession" connectionString="user id=user;password= pass;Server=server;Database=database_Session"/>

Add a config file with bellow text into /website/App_Config/Include/zzz folder. This is for shared session

<?xml version="1.0" encoding="utf-8" ?>
     <!-- 
       Patching file for SQL SharedSession provider 
    -->
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
      <sitecore>
        <tracking>
          <!-- it removes existing shared session provider-->
          <sharedSessionState>
            <patch:delete  />
          </sharedSessionState>
          <!-- add new sql session state provider-->
          <sharedSessionState defaultProvider="mssql">
            <providers>
              <clear/>
              <add
         name="mssql"
         type="Sitecore.SessionProvider.Sql.SqlSessionStateProvider,Sitecore.SessionProvider.Sql"
         connectionStringName="sharedsession"
         pollingInterval="2"
         compression="true"
         sessionType="shared"/>
            </providers>
            <manager type="Sitecore.Analytics.Tracking.SharedSessionState.SharedSessionStateManager, Sitecore.Analytics">
              <param desc="configuration" ref="tracking/sharedSessionState/config" />
            </manager>
            <config type="Sitecore.Analytics.Tracking.SharedSessionState.SharedSessionStateConfig, Sitecore.Analytics">
              <param desc="maxLockAge">5000</param>
              <param desc="timeoutBetweenLockAttempts">10</param>
            </config>
          </sharedSessionState>
        </tracking>
      </sitecore>
    </configuration>

For private session follow next steps :

Open \Website\web.config file and locate the sessionState section:

Update the sessionState section by adding the SQL Server provider as shown in the following example. Also, change the name attribute value to mssql:

<sessionState mode="Custom" customProvider="mssql" cookieless="false" timeout="20">
  <providers>
    <add name="mssql"
type="Sitecore.SessionProvider.Sql.SqlSessionStateProvider,Sitecore.SessionProvider.Sql" connectionStringName="session" pollingInterval="2" compression="true" 
         sessionType="private"/>
  </providers>
</sessionState>
2
  • I have one more query, will it be okay if I use same database for both Shared and Private session? I mean, let's say only one connection string with name as "sharedsession" for which I will configure session state in web.config and Sitecore.Analytics.Tracking.config patch. Jul 21, 2017 at 7:40
  • 1
    you need to have 2 connection strings but it can point to same database. Jul 21, 2017 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.