title: When does HttpRequest get created?
body: <p>In my MVC web application, I'm checking Request.IsLocal to see if the application is running on my machine--if it is, I set a Global static variable which tells the rest of my application that I am in 'Debug Mode'.</p>
  
  <p>The problem is, I don't know when to do this check.</p>
  
  <p>I tried to do it in the global.asax.cs file, under Application_Start(), like this:</p>
  
  <pre><code>protected void Application_Start()
  {
      if (Request.IsLocal)
          isDebug = true;
  
      AreaRegistration.RegisterAllAreas();
      RegisterRoutes(RouteTable.Routes);
      ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory());
  }
  </code></pre>
  
  <p>The trouble is, the Request object has not been initialized yet.  I get a HttpException which says </p>
  
  <blockquote>
    <p>The incoming request does not match any route</p>
  </blockquote>
  
  <p>So, my question is when does the Request object get initialized, and is there an event of some sort that I could handle in order to run this check after the Request object is ready?</p>