Flash messages in ASP.NET MVC without sessions

Posted by Fernando Correia on Programmers See other posts from Programmers or by Fernando Correia
Published on 2012-05-30T23:36:17Z Indexed on 2012/05/31 4:49 UTC
Read the original article Hit count: 353

Filed under:
|

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?

© Programmers or respective owner

Related posts about c#

Related posts about asp.net-mvc