Asp.net-mvc – Specifying read-only session in ASP.NET MVC

asp.net-mvcsession

Is there any way to specify that a given Controller or Action uses Session state in a read-only manner? In "old" ASP.NET we used to do something like this:

<%@ Page EnableSessionState="ReadOnly" %>

Is there an ASP.NET MVC equivalent? I'm looking to allow my application to serve multiple requests from the same client simultaneously, and turning off session completely is -not- an option in my case.

Best Answer

In Asp.Net MVC3 there is now a SessionStateAttribute that you can decorate your Controller with to force all actions into Read-Write, Read-only, or No session mode.

http://msdn.microsoft.com/en-us/library/system.web.mvc.sessionstateattribute(v=VS.98).aspx