Alachisoft NCache 3.8

Using Session State Store Provider

NCache Session State Provider is a custom SessionStateStoreProviderBase implementation for an ASP.NET application. This implementation reads and writes ASP.NET session data from and to the cache. This allows you to transparently save and retrieve ASP.NET session-state objects within a webfarm. SSP is a better approach than HttpModule for implementing the ASP.NET sessions. It is flexible and more reliable than HttpModule.

Note: This feature is available only for .NET Framework version 2.0 and later.

Configuration Steps


Please follow these steps for enabling NCache Session Store Provider to transparently save and retrieve ASP.NET session state.

  1. Edit your application's web.config file and modify the <sessionState> section as given below. Place the following code under <System.Web> tag.

    <assemblies>

    <add assembly = "Alachisoft.NCache.SessionStoreProvider,

        Version=3.8.x.x, Culture=neutral,

        PublicKeyToken=CFF5926ED6A53769"/>

    </assemblies>

    <sessionState cookieless = "false"

       regenerateExpiredSessionId = "true"

       mode = "Custom"

       customProvider = "NCacheSessionProvider"

       timeout = "10">

    <providers>

    <add name = "NCacheSessionProvider"

           type = "Alachisoft.NCache.Web.SessionState.NSessionStoreProvider"

           sessionAppId = "1234"

           cacheName = "myCache"

           enableSessionLocking = "false"

           sessionLockingRetry = "-1"

           writeExceptionsToEventLog = "false"

           enableLogs = "false"

           enableDetailLogs = "false"

           exceptionsEnabled = "false"/>

    </providers>

    </sessionState>


    Note:

    • Replace "X.X" of the "Version" with the actual version of NCache you have.

    Following is the description of different key-value pairs specified above:


  1. Add <machinekey> entry under <system.web> section in web.config. It is required to generate ASP.NET session IDs in the same manner on all nodes. You can use the genmackeys utility available with NCache installation to generate the keys.

    <machineKey

    validationKey = "A01D6E0D1A5D2A22E0854CA612FE5C5EC4AECF24"

    decryptionKey = "ACD8EBF87C4C8937"

    validation = "SHA1"/>



See Also

Session Locking in NCache Session Store Provider | Using Session State Module | Using sessions in geographically separated web farms