Disable Session state per-request in ASP.Net MVC

If anyone is in the situation I was in, where your image controller actually needs read only access to the session, you can put the SessionState attribute on your controller [SessionState(SessionStateBehavior.ReadOnly)] See http://msdn.microsoft.com/en-us/library/system.web.mvc.sessionstateattribute.aspx for more info. Thanks to https://stackoverflow.com/a/4235006/372926

Can I access session state from an HTTPModule?

Found this over on the ASP.NET forums: using System; using System.Web; using System.Web.Security; using System.Web.SessionState; using System.Diagnostics; // This code demonstrates how to make session state available in HttpModule, // regardless of requested resource. // author: Tomasz Jastrzebski public class MyHttpModule : IHttpModule { public void Init(HttpApplication application) { application.PostAcquireRequestState += new EventHandler(Application_PostAcquireRequestState); application.PostMapRequestHandler += … Read more