title: Sessions stored in a co-located Azure cache gets out of sync on multiple instances
body: <p>For my MVC4 application, run in Azure, I store the sessions in a co-located cache. As described in <a href="https://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/#store-session" rel="nofollow noreferrer">this How-to</a> that Microsoft provide.</p>
  
  <p>I run two small instances, and everything seems to work fine. I can log in to the application, and I remain logged in when I browse around within the application. So the session seem to work on both instances.</p>
  
  <p>However, when I update the session data something like this:</p>
  
  <pre><code>HttpContext.Current.Session["someVar"] = "new value";
  </code></pre>
  
  <p>That change only seem to have an effect on the instance that handle that particular request. Now as I browse around the application, sometimes I get the initial value and sometimes I get the updated value.</p>
  
  <p>I haven't made any changes to the web.config, so it looks exactly as it do when it gets added by the Nuget package:</p>
  
  <pre><code>&lt;sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider"&gt;
    &lt;providers&gt;
      &lt;add name="AppFabricCacheSessionStoreProvider"
            type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache"
            cacheName="default"
            useBlobMode="true"
            dataCacheClientName="default" /&gt;
    &lt;/providers&gt;
  &lt;/sessionState&gt;
  </code></pre>
  
  <p><strong>Do I need to handle sessions in another way when using the Azure cache, or is it something else I'm missing here?</strong></p>