Flash messages in ASP.NET MVC without sessions
- by Fernando Correia
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:
Is there an alternative way to use TempData that doesn't require sessions or shared data between servers? Cookies perhaps?
Is there a better alternative I'm overlooking?