title: Application_Error no longer triggers when published to IIS
body: <p>OK I have the following code in my Global.asax file:</p>
  
  <pre><code>void Application_Error(object sender, EventArgs e)
  {
      // Code that runs when an unhandled error occurs
          Exception objError = Server.GetLastError().GetBaseException();
  
          Response.Redirect(
              String.Format(
              "/Error/{0}/{1}",
              ((HttpException)objError).GetHttpCode(),
              Request.RawUrl));
  }
  </code></pre>
  
  <p>To provide neat and tidy error urls like "/Error/404/TheNameOfTheRequestedPage". This works fine from VS 2008, but once published to my local machine, I get the default error page:</p>
  
  <blockquote>
    <p><strong>Error Summary</strong></p>
    
    <p>HTTP Error 404.0 - Not Found</p>
    
    <p>The resource you are looking for has
    been removed, had its name changed, or
    is temporarily unavailable</p>
  </blockquote>
  
  <p>Anyone know how to do this? I've chosen not to use system.web/customErrors because I don't have access to Server.GetLastError() from there (or at least it's never worked for me) and I want to get the http code.</p>