Current recommendation for enabling session on Azure sites for session variables and TempData?

I have an MVC3, ASP.NET 4.5 web application deployed to Azure sites using SQL Azure.

I am currently using some "inproc" session variables that I need to remove as I am about to start using multiple website instances. I could just store the values โ€‹โ€‹of the Session variable in the SQL Azure DB, but I also use TempData, which also uses session state under the hood. Due to the use of TempData, I need to implement a solution "from proc".

I've seen some guidelines for using AppFabric caching, but I'm not sure if it's still up to date or correct for Azure sites.

Also my development setup is on a Windows 7 machine with SQL Server 2008 R2. Thus, the solution should be tolerated with minimal pain.

There is also the issue of "thread flexibility" with session variables, and open source was built using REDIS caching, but I have no experience with that or REDIS. See: GitHub site

So, I have thoughts:

1) Custom Angieslist / AL-redis provider, see GITHUB link . Not really sure if this can be used in the Azure Websites app.

2) Appfabric. Not sure if this is relevant or relevant for Azure Websites.

3) SQL Azure Session Provider.

4) Azure table storage.

5) Use the provider TempData custome for saving via cookies, i.e. https://www.nuget.org/packages/BrockAllen.CookieTempData.dll/1.2.2 and then remove other session variables.

I would be very grateful for advice on a good mechanism for implementing an Azure Websites session that is simple. My data is pretty simple. I think I have one object that I need, I will need to be serialized, possibly via Json.NET

+3


source to share


2 answers


If you have more than one Azure Web Site instance, sticky sessions are enabled by the load balancer by default. This means that the user will be redirected to the same instance (server) and that you can use the session state in your application.



+8


source


You may also find the Distributed Caching (Ch 12) section of this book helpful http://aka.ms/CloudApps_PDF



+1


source







All Articles