---
title: "Walkthrough: Configuring a private session state database using the Redis provider"
slug: "walkthrough--configuring-a-private-session-state-database-using-the-redis-provider"
abstract: "Learn how to use Redis as your private session state store."
---
# Walkthrough: Configuring a private session state database using the Redis provider

In a private session state, all data related to a specific interaction, such as viewed pages, converted goals, triggered campaigns, or accumulated engagement points, is collected and saved to the session state database.

Sitecore supports two versions of Redis session state provider: [synchronous](https://doc.sitecore.com/xp/en/developers/104/platform-administration-and-architecture/walkthrough--configuring-a-private-session-state-database-using-the-redis-provider.html#UUID-5a52b1ea-68f7-3371-3e76-22f4626a6ac7_N1525267105554 "Configure synchronous Redis session state provider") and [asynchronous](https://doc.sitecore.com/xp/en/developers/104/platform-administration-and-architecture/walkthrough--configuring-a-private-session-state-database-using-the-redis-provider.html#UUID-5a52b1ea-68f7-3371-3e76-22f4626a6ac7_N1603367023666 "Configure asynchronous Redis session state provider"). This walkthrough describes how to use Redis as your private session state store using the Sitecore ASP.NET Session state store provider for Redis.

> [!warning]
> To prevent unexpected behaviors such as data loss, we recommend that you do not enable `aspnet:AllowConcurrentRequestsPerSession`. These issues might occur when using this option because the session is not blocked during the request.

> [!note]
> Sitecore does not support Redis Cluster.

> [!note]
> Although Azure Managed Redis supports Microsoft Entra ID authentication, this authentication method is not currently supported by Sitecore. Use supported authentication methods instead.

<details>
<summary><h2>Configure synchronous Redis session state provider</h2></summary>

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 the xDB needs to track website visits.

To deploy a Redis session database:

1. Choose between Azure Redis or [Redis on premise](https://redis.io/). You can provision Azure Redis by using the instructions on the [Microsoft Azure website](https://azure.microsoft.com/en-us/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/) or with [Azure PowerShell](https://azure.microsoft.com/en-us/documentation/articles/cache-howto-manage-redis-cache-powershell/)
2. Go to the `<sitename>\App_Config\` folder, open the `ConnectionStrings.config` file, and add the following connection string:

    ```text
    <add name="session" connectionString="_host_:_port_number _" />
    ```

3. Configure the connection string so that it points to your session database.
4. Save your changes.

</details>

<details>
<summary><h2>Configure Sitecore</h2></summary>

To configure Sitecore to use the private Session state store provider for Redis:

1. Go to your site root folder, open the `web.config` file, and locate the `sesssionState` section:

    ```text
    <sessionState mode="InProc" cookieless="false" timeout="20">
    ```

2. In the `sessionState` section, update the `customProvider` attribute to use the *Redis* provider instead of *InProc*, as shown in the following example. Also, change the value of the `name` attribute value to `redis`:

    ```xml
    <sessionState mode="Custom" customProvider="redis" timeout="20">
      <providers>
        <add name="redis"
          type="Sitecore.SessionProvider.Redis.RedisSessionStateProvider,
          Sitecore.SessionProvider.Redis"
          connectionString="session"
          pollingInterval="2"
          applicationName="private"/>
      </providers>
    </sessionState>
    ```

</details>

<details>
<summary><h2>Configure asynchronous Redis session state provider</h2></summary>

To configure Sitecore to use the private asynchronous session state store provider for Redis:

1. Go to your site root folder, open the `web.config` file, go to `<system.webServer>` and locate the `<module>` section.
2. In the `<module>` section, replace:

    ```text
    <add name="Session" type="System.Web.SessionState.SessionStateModule" />
    ```

    with:

    ```text
    <add name="Session" type="Microsoft.AspNet.SessionState.SessionStateModuleAsync, Microsoft.AspNet.SessionState.SessionStateModule" />
    ```

3. Go to `<system.web>` and in the `<sessionState>` section find:

    ```text
    <sessionState mode="InProc" cookieless="false" timeout="20">
    ```

    and update the `customProvider` attribute to use the *Redis* provider instead of *InProc*. For example:

    ```xml
    <sessionState mode="Custom" customProvider="redisasync" timeout="20">
    <providers>
    <add name="redisasync"
    type="Sitecore.SessionProvider.Redis.RedisSessionStateProviderAsync,
    Sitecore.SessionProvider.Redis"
    connectionString="session"
    pollingInterval="2"
    applicationName="private"/>
    </providers>
    </sessionState>
    ```

</details>

<details>
<summary><h2>Adjust the Redis provider settings</h2></summary>

To configure your session state:

- Use the [Redis provider settings reference](https://doc.sitecore.com/xp/en/developers/104/platform-administration-and-architecture/redis-provider-settings-reference.html "Redis provider settings reference").

If you have configured everything correctly, session records appear in your Redis session database after the first web request.

</details>