title: Application_End being called too early/frequently
body: <p>I am using a temporary database in a project that is disposed on <code>Application_End</code>:</p>
  
  <pre><code>protected void Application_End() {
      if (_db != null) _db.Dispose();
  }
  </code></pre>
  
  <p>The problem is that Application_End seems to be called frequently whilst I am browsing through my web project - it seems that when I edit an object in the db, the change is successfully made, the database is disposed, and by the time I am redirected to the index - a new db has been created and shows the unchanged object as if nothing had happened. </p>
  
  <p>Shouldn't Application_End only being called when the session is ended or after a certain amount of idle time?</p>
  
  <p>Could anyone tell me how I may be able to ensure that Application_End is only called when I am actually finished using the application?</p>