title: Display Custom Error Pages on IIS 7.5 and IIS 7
body: <p>I use Asp.net 4 C# and IIS 7 locally and IIS 7.5 on Production Server.</p>
  
  <p>I need display Custom Error Pages. At the moment I use some logic in my Global.asax to bypass IIS default pages.
  Locally using IIS 7 I was able to successfully display CustomPages but on production (IIS 7.5) Server defaults IIS pages persists.
  I use <code>Response.TrySkipIisCustomErrors = true;</code> but on Production Server does not work.</p>
  
  <p>Could you point me out a solution to this problem?</p>
  
  <p>My code in <code>Global.Asax</code></p>
  
  <pre><code>Application_Error
  
  Response.TrySkipIisCustomErrors = true;
                  if (ex is HttpException)
                  {
                      if (((HttpException)(ex)).GetHttpCode() == 404)
                      {
  
                          Server.Transfer("~/ErrorPages/404.aspx");
                      }
                  }
                  // Code that runs when an unhandled error occurs.
                  Server.Transfer("~/ErrorPages/Error.aspx");
  </code></pre>