Alachisoft NCache 3.8

Using NCache Session State Module

NCache Session State Module allows you to transparently save and retrieve ASP.NET session-state objects within a webfarm.  As compared to ASP.NET Session State Module which is centralized in nature, NCache Session State Module is truly distributed. It benefits from clustered caching and thus, it implicitly avoids single point of failure. Also, when running cache as InProc, no extra cost is involved in retrieving session-state objects.


Configuration Steps


Please follow these steps for enabling NCache Session State Module to transparently save and retrieve ASP.NET session-state objects.


  1. Edit your application's web.config file to add <appSettings> entry under <configuration> section.

    <appSettings>

      <add key = "CacheName" value = "myReplicatedCache"/>

      <add key = "sessionAppId" value = "1234"/>

      <add key = "exceptionsEnabled" value = "true"/>

      <add key = "enableLogs" value = "false" />

      <add key = "enableDetailLogs" value = "false"/>

      <add key = "clearASPSession" value = "false"/>

      <add key = "writeExceptionsToEventLog" value = "false"/>

    </appSettings>


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



  1. Add <httpmodules> entry under <system.web> section in web.config.

    <httpModules>

    <add name = "NCacheWebSessionState" type = "Alachisoft.NCache.Web.SessionState.NSessionStateModule,

      Alachisoft.NCache.SessionState, Version=3.8.X.X, Culture=neutral, PublicKeyToken=cff5926ed6a53769"/>

    </httpModules>


    Note: Replace "X.X" of the "Version" with the actual version of NCache you have.
  2. 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.

    <machineKey validationKey = "A01D6E0D1A5D2A22E0854CA612FE5C5EC4AECF24" decryptionKey = "ACD8EBF87C4C8937" validation = "SHA1"/>


Special Considerations when Storing ASP.NET 1.1 Sessions in NCache


Session.Redirect(url, false)


Session.Abandon()


Using Session in your own custom HttpModules


Using Session.Clear()



See Also

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