 <p>A couple of ways:</p> <p>In your web.config on the customErrors mode set the <a href="http://msdn.microsoft.com/en-us/library/system.web.configuration.customerrorssection.redirectmode.aspx" rel="nofollow noreferrer"><code>redirectMode</code></a> to <code>ResponseRewrite</code> - this removes the 302 redirect from the server to the error page - this also has the happy coincidence that uses can easily see what the original page they requested was, and can retry with an F5 if that's likely to resolve the issue.</p> <p>If you are hooking into the ApplicationError event, make sure that rather than redirecting to your error pages you use <code>Server.Transfer</code> instead.</p> <p>I have the following in one of my web.configs:</p> <pre><code>&lt;customErrors mode="On" defaultRedirect="ErrorHandler.aspx" redirectMode="ResponseRewrite"&gt; </code></pre> <p>Then in my ErrorHandler page I check for the last error from the server, and configure those:</p> <pre><code> var serverError = Server.GetLastError(); var error = serverError as HttpException; int errorCode; string errorMessage; if (null != error) { errorCode = error.GetHttpCode(); errorMessage = error.GetHtmlErrorMessage(); } else { errorCode = 404; errorMessage = "Page not found"; } Response.StatusCode = errorCode; Response.StatusDescription = errorMessage; </code></pre> <p>Obviously you may want to do additional processing - for example before I do all this I'm comparing the original request with my Redirects database to check for moved content/vanity urls, and only falling back to this if I couldn't find a suitable redirect.</p>