title: ASP.NET MVC 4 Session timeout
body: <p>I am developing an Internet app with ASP.NET MVC4 using VS 2012, IIS 7.5. I am using Forms Authentication for the same. The settings in my web config is as follows.</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
      &lt;forms loginUrl="~/Account/Login" timeout="30" name="userInfo" slidingExpiration="true" enableCrossAppRedirects="false" protection="All" &gt;
      &lt;credentials passwordFormat="Clear"/&gt;
    &lt;/forms&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>But the Idle Timeout (minutes) setting in IIS  is 20. When I refresh my application after 20+ minutes I am getting an error saying one of my session objects is null. But if I refresh my app after 30 minutes, it is working fine, that it is redirecting me to the login page. After entering the credentials, I am navigated properly to the appropriate page.</p>
  
  <p>I am not understanding why I am getting an error after 20 minutes! (which is the IIS idle time settings as far as I know). Please help.</p>
  
  <p>Thanks</p>