Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing a web application for Windows Azure using ASP.NET MVC 4. I would like to enforce one restriction in the architecture: do not use Session.

To achieve availability on Azure, and since there is no sticky sessions, I would need to store the session data in some central service, probably either SQL Azure or the Caching Service.

I would rather avoid sessions on the SQL database to avoid the increased latency, and the caching service on Azure is very expensive for the ammount of memory offered.

On the other hand, I would like to have the ability to easily pass Flash-style messages among redirects. TempData is the recommended way to do this, but by default it uses the session object.

So I would like to know:

  1. Is there an alternative way to use TempData that doesn't require sessions or shared data between servers? Cookies perhaps?
  2. Is there a better alternative I'm overlooking?
share|improve this question
You should ask this question on StackOverflow. You'll get answers from some expert MVC & Azure people. – BZink Jun 6 '12 at 20:00
I suppose you are right. I asked here because it's related to architecture. In fact it's a very subjective line between "conceptual questions about software development" and "programming Q & A". Thanks! – Fernando Correia Jun 7 '12 at 12:04
up vote 1 down vote accepted

I worked with Azure for almost 2 years, I had dreams of building my own caching service using an Azure worker role and something like memcached. I never got around to it but it still sounds like fun, and I think it would meet your needs.

Steve Marx (former azure evangelist) wrote about it on his blog a while back...

share|improve this answer
Thank you. I agree, running memcached either in a worker role or even in the web roles themselves might be a cheaper alternative to the caching service. The tradeoff is some additional work. Heck, we could even run it in Linux now that Azure can host durable Linux instances. – Fernando Correia Jun 7 '12 at 12:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.