title: Global.asax Application_Error not firing on IIS
body: <p>I have an ASP.NET MVC 2 page. During error or exception, the Application_Error method in Global.asax is not firing on IIS7.</p>
  
  <p>**But it does fire if I run the web app from VS2010 (localhost:someport)</p>
  
  <p>My code (C#):</p>
  
  <pre><code>protected void Application_Error(object sender, EventArgs e)
  {
    Exception exception = Server.GetLastError();
    string requestedUrl = HttpContext.Current.Request.Url.ToString();
  
    Response.Clear();
    // do something
    Server.ClearError();
    Server.Redirect("Error");
  }
  </code></pre>
  
  <p>My config:</p>
  
  <pre><code>&lt;customErrors mode="On" defaultRedirect="~/Error"&gt;
  &lt;/customErrors&gt;
  
  &lt;system.webServer&gt;
    &lt;validation validateIntegratedModeConfiguration="false"/&gt;
    &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>Please help.</p>