In a shared session state, all data that can be shared across multiple sessions, for example, the data related to contacts and devices, is collected and saved to the session state database.
You must always configure a shared session state, regardless of your server configuration. For example, you can have a single standalone Content Delivery (CD) server, multiple content delivery servers, or a clustered environment, but you always need to configure a session state.
A shared session state is not supported on Content Management (CM) servers.
A contact can make multiple parallel visits to a website, in which case each visit has its own private session state. However, some data can be shared between visits, such as device and contact related information.
Information that is shared between parallel visits by the same contact is stored in the shared session state store. This data is still private to the contact but it is accessible from all current sessions made by the same contact.
You can use the Sitecore Redis, Sitecore MongoDB, or Sitecore SQL Server providers to configure your shared session state store. These providers support the
SessionEnd event that xDB needs to track website visits.
OutOfProcSessionStateStore that ships with ASP.NET does not support the
SessionEnd event and therefore cannot be used with shared session state.
You can configure a shared session state to use any session state store provider that extends the abstract class
SessionStateStoreProviderBase (shipped with ASP.NET). The only condition is that the session-state store provider must invoke the
SessionEnd event via
The shared session state provider for MongoDB is not included as a part of xDB Cloud.
This walkthrough describes how to use Redis as your shared session state store using the Sitecore ASP.NET session state provider for Redis:
Deploy a shared Redis session database
The Sitecore ASP.NET session state store provider for Redis enables you to use Redis as your session state store. The provider supports the
SessionEnd event, which xDB needs to track website visits.
To deploy a Redis session database:
- Choose between Azure Redis or Redis on premise. You can provision Azure Redis by using the instructions on the Microsoft Azure website or with Azure PowerShell.
- Go to <sitename>
\App_Config, open the
ConnectionStrings.configfile and add the following connection string:
<add name="sharedsession" connectionString="_host_:_port_number _" />
- Configure the connection string so that it points to your session database.
- Save your changes.
To configure Sitecore to use the shared session state provider for Redis:
- In your site root folder, go to Website\App_Config\Include.
- Open the
- Locate the line where you can define the default shared session state provider using the following path: sitecore/tracking/sharedSessionState.
- Update the
sharedSessionStatesection to use Redis as the
InProcas shown in the following example. Also, change the name attribute value to
<add name="redis" type=" Sitecore.SessionProvider.Redis.RedisSessionStateProvider, Sitecore.SessionProvider.Redis " connectionString="sharedsession" pollingInterval="2" applicationName="shared" />
Adjust the Redis provider settings
Use the Redis provider settings reference to configure your session state.
If you have configured everything correctly, session records should appear in your Redis session database after the first web request.