Question

I want to be able to use dedicated or co-located caching in my Azure web roles.

The problem is that the application I am migrating uses HttpSessionState extensively. I don't want to change all of this code because:

  1. This is time consuming (especially with testing)

  2. I can't enforce developers from using HttpSessionState

  3. I want to avoid vendor locking as much as possible

Is there no session provider for dedicated and co-located caching so that I can keep existing code as is?

Was it helpful?

Solution

I fixed the problem. To use the ASP.NET Session State in the dedicated or co-located Azure caching, the following session provider needs to be setup in the web.config:

<sessionState mode="Custom" customProvider="AFCacheSessionStateProvider">
  <providers>
    <add name="AFCacheSessionStateProvider"
         type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache"
         cacheName="default" dataCacheClientName="default"
         applicationName="AFCacheSessionState"
    />
  </providers>
</sessionState>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top