title: ASP.NET MVC: how to prevent a session lock?
body: <p>I've an application which has some controller's actions calling slow 3rd party web services. These actions are called using AJAX calls from the page.</p>
  
  <p>I can use async controllers to free ASP.NET thread pool, that's great. But what about session? If I use InProc session and a request made to "slow action" the particular user can't make any request to the application because his session is locked by first "slow" call. </p>
  
  <p>In PHP there is a method <a href="http://php.net/manual/ru/function.session-write-close.php"><code>session_write_close()</code></a> which I can use as following:</p>
  
  <ol>
  <li>Accept user's request to slow action</li>
  <li>Check rights of the user to access controller/action based on session data</li>
  <li>Write something to the session if needed</li>
  <li>Call <code>session_write_close()</code>. <strong>From this point session is closed by this request and any other request from the same user can access it</strong></li>
  <li>Make my slow call (maybe in some async way)</li>
  </ol>
  
  <p>I know that I can disable session state on the controller level using <code>[SessionState]</code> attribute, but that's not the solution.</p>
  
  <p>Any ideas?</p>