title: IIS7 and Classic ASP Sessions
body: <p>I've got an old web app written in Classic ASP which used to run on an IIS6 server no problem, then long story short, I moved it onto a Linux server running SunOne ASP which also worked fine (after a couple of minor tweaks), and now in a bid to access some 3rd party COM controls the app originally used, I've moved it back again to a Windows server, this time 2008 running IIS7.  </p>
  
  <p>On the whole the app works fine, but there seems to be a random problem now with the session variables getting lost. The implication of this is that the user gets automatically logged out of the system.  </p>
  
  <p>It's all pretty simple stuff, and just uses the a session variable to hold the logged in status (as well as a couple of other bits and pieces).</p>
  
  <pre><code>If Session("login_status") &lt;&gt; "loggedin" Then 
   Response.Status="302 Object moved"
   Response.Redirect "/admin/default.asp"
  End If
  </code></pre>
  
  <p>The app is running on a shared hosting server, and what I'm worried about more than anything else is why this is happening, mostly so if I have to host any other ASP apps on the same platform I'm not going to run into similar problems.  </p>
  
  <p>Could this be because IIS7 is recycling the application pool and wiping out any session data in the process? And if that's the case, what could be done about it, short of course of writing my own state management/session handler routine, which is next on the cards if all else fails?</p>