Table Storage Session Provider for Azure is now obsolete, easiest option – Sql Server

While migrating my legacy web application(Upgraded to framework 4.5 from .net 1.1) to Windows Azure, I found that application session was getting expired very frequently even not retaining it for 20 minutes, default for a web application. When I checked the config, found that session mode is Inproc. Azure does not support inproc as with load balancer azure uses round robin allocation across multiple instances. So, I explored few session storage options and now sharing my experience here. Before moving ahead, I would like to share my azure version too. I have latest 2.4 SDK for Azure with VS2013.

TableStorageSessionProvider : Initially my first choice was to use Table storage as it was looking very easy to implement. By following all mentioned steps in different blogs and articles, I found that everywhere reference of same article(above link) has been given. During my implementation I found that updated azure does not support Table Storage Session Provider sample code /dll  as this dll version is obsolete for now and there is no new update on it..

In very beginning of 2010-2011 Microsoft Azure team has provided a sample project dll/code to use it and every blog/article mentioned it. Here is the link

http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_buildingaspnetappswithwindowsazure_topic4#_Toc300153323

Unfortunately, till now there is no support for it , even now, they have removed the link from msdn. So I suggest, don’t waste time on it as I did 🙂 . Below is a brief regarding it:

I . After implementing it, code was running correctly with emulator but when I moved my application on Azure, it didn’t resolved my session issue and throwing some run time error . Even after spending my several hours nothing was fruitful. What all I understood is that error was due to compatibility of  sample code with latest version of Azure. I posted my question in several blogs but still it is unanswered. Then I moved to try other options like Sql Session.

SqlServer the easiest option:  I found SqlServer the easiest option to keep session state in Azure. Only we need to install nuget package Package Microsoft.Aspnet.Providers  and then remove unused/unwanted additional settings like role, membership provider etc. from web.config.

if you want to use it, I would like to suggest a very good article by Kunal, Microsoft Azure MVP. Also, this is the blog which confirmed me about outdated Table Storage dll.

http://sanganakauthority.blogspot.in/2014/08/session-management-using-sql-azure-and.html

Advertisements