Sitecore Session state

Session state enables you to store and retrieve values for a user as the user navigates pages in a Web application. HTTP is a stateless protocol. This means that a Web server treats each HTTP request for a page as an independent request. The server retains no knowledge of variable values that were used during previous requests. ASP.NET session state identifies requests from the same browser during a limited time window as a session, and provides a way to persist variable values for the duration of that session.

As a visitor browses around your site, information about that visitor and their interaction is stored in session. When the session ends, this information is flushed to the xDB. In the Sitecore Experience Database, you can use a session state server to track all your contact sessions across different browsers and devices.

In xDB, there are two types of session states:

  • Private
  • Shared

Private session state

In private session state, all analytics session data related to a specific interaction is collected and saved to the session state server.

The private session data collected during a session includes data on the interaction, and the devices used by a contact.

The default provider is the in process (inProc) session provider which uses session state stored in-memory. This is suitable for small, standalone installations used for test or development purposes.

If you have a multi-server environment you should use one of the following out of process ASP.NET session state providers:

  • Sitecore ASP.NET Session State Provider for MongoDB
  • Sitecore ASP.NET Session State Provider for Microsoft SQL Server

Shared session state

Contact data is collected and stored in a dedicated Shared session state store. This works in the same way as ASP.NET session state. When you configure shared session state, you can use in process or choose the MongoDB or the SQL Server session provider to support out of process session state.

Shared session state data includes all data that is unique to a contact and that can be shared across simultaneous sessions, such as contact details, devices and engagement automation states triggered

You can configure session state in two different ways: as either in process (InProc) or out of process.

In process

In process (InProc) is the default session state provider that comes with the Microsoft .NET Framework. It uses internal memory to track interactions and visits.

In process is the most suitable way of handling private session state for all data related to a specific interaction (single visitor session or visit). It is the recommended mode to use for content management servers.

Out of process

Out of process session state means that you use an external ASP.NET session state provider such as Redis, MongoDB or SQL Server. You can also use any custom provider that supports the Session_End event. Out of process is suitable for handling shared or private session state if you have multiple content delivery servers.

Session state configuration

SQL Server Provider

Private session config entry – web.configprivate-session-sql

Configuring a private session state database using the SQL Server provider

Shared Session config entry – Sitecore.Analytics.Tracking.config file.


Configuring a shared session state database using the SQL Server provider

MongoDB Provider

Private session config entry – web.config


Configuring a private session state database using the MongoDB provider

Shared session config entry – Sitecore.Analytics.Tracking.config file


Configuring a shared session state database using the MongoDB provider

Related pages-




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s