title: How to call some code once per page request
body: <p>I am trying to execute some code once for any page request so I put this code in the Application_PreRequestHandlerExecute method in Global.asax.  The problem is that for each page request this methods gets called perhaps 10 times or more.  So, the question is how do I get my code to get called only once per request?  I tried adding this to the Application_PreRequestExecute method:</p>
  
  <pre><code>const string key = "scanning_forms";
  object chack = HttpContext.Current.Items[key];
  if (chack == null)
  {
      // Code I want to execute only once
  }
  </code></pre>
  
  <p>The problem is though that for some reason check is always false!  Any ideas?  Incidently, I am using Sitecore.  I don't think that should be significant though.</p>
  
  <p>Thanks,</p>
  
  <p>Sachin</p>