title: SessionStateModule vs runAllManagedModulesForAllRequests="true"
body: <p>At the moment I have the attribute <code>runAllManagedModulesForAllRequests="true"</code> set, so my modules are running for all the requests. I guess that includes the <code>SessionStateModule</code>.</p>
  
  <p>When trying to access the session object in the <code>PostAcquireRequestState</code> event handler in one of my custom modules, the <code>HttpContext.Current.Session</code> is null when the <code>HttpApplication.Context.CurrentHandler</code> is null (e.g.: for a JS/CSS file), and it is not null when the handler is <code>MvcHandler</code> (because it is a managed handler I guess).</p>
  
  <p>I have been taking a look to the <code>SessionStateModule</code> code in ILSpy and I couldn't find where is taking the decision of skip Session for that request. </p>
  
  <p>I have been looking in <code>%windir%\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config</code> and there is no mention of <code>SessionStateModule</code>, and in the <code>Web.config</code> in that folder I found:</p>
  
  <pre><code>&lt;add name="Session" type="System.Web.SessionState.SessionStateModule" /&gt;
  </code></pre>
  
  <p>So it is not using any precondition like <code>managedHandler</code>.</p>
  
  <p>Does anybody know why is the <code>SessionStateModule</code> skipping requests for non-managed resources even when the attribute <code>runAllManagedModulesForAllRequests</code> is set?</p>
  
  <p>Cheers.</p>