Windows Azure & ASP.NET session Windows Azure & ASP.NET session azure azure

Windows Azure & ASP.NET session


As Nariman stated, you can't have server affinity - the load balancing is beyond your control. You can use either table storage or SQL Azure for session state. I don't really see much value in storing session state in blobs.

See this post on the SQL Azure blog, from August 2010, to see how to implement session storage in SQL Azure. This will allow you to manage session state across instances as you scale up.

EDIT 6/16/2014 - The Redis cache supports this. See Azure Redis Cache (Preview) ASP.NET Session State Provider

EDIT 5/23/2012 - Wow, lots has changed since I posted this. SQL Azure is fully supported as a session state provider (via Universal Providers, shipping since v1.4), as well as Windows Azure Cache. More details are provided in this StackOverflow answer.


You won't notice a difference on a single-instance deployment that uses InProc but you do need to rely on out of process Blob & Table storage if you plan on running multiple web roles. (There's no way to keep a user pegged to the same instance in Azure load-balancing, AFAIK.)


With the October 2012 release of the Azure SDK they provided a special session provider that can use the "Co-Located Role Caching" as a special back end for session. It allows you to use the role-level caches rather than having to choose from table storage or SQL Azure only. There are instructions on how to configure that here:

http://dotnetthread.com/articles/27-Setting-up-Windows-Azure-Caching-for-Session-State-Management.aspx