Note that there are some explanatory texts on larger screens.

plurals
  1. POIIS overriding custom 404 error page in ASP.NET
    primarykey
    data
    text
    <p>I am trying to create a 404 error page and currently I have all of the following/tried all of the following to try and accomplish this. When the user types in :</p> <p><a href="http://name/something.aspx" rel="nofollow">http://name/something.aspx</a></p> <p>It works just as its supposed to. But if the user types in:</p> <p><a href="http://name/NotAFile" rel="nofollow">http://name/NotAFile</a></p> <p>with no .aspx then IIS7 takes matters into its own hands and I get the lovely error page that IIS7 comes with. The goal is that the site redirects with only a 404 status code (so not a 200, or a 302 redirect). I have tried in both the web config with:</p> <pre><code>&lt;customErrors mode="On" defaultRedirect="~/error/Default.aspx redirectMode="ResponseRewrite"&gt; &lt;error statusCode="404" redirect="~/error/NotFound.aspx" /&gt; &lt;/customErrors&gt; </code></pre> <p>This works for the url with a .aspx file extension but not for no extension. Same with this approach in the global.asax</p> <pre><code>void Application_Error(object sender, EventArgs e) { var serverError = Server.GetLastError() as HttpException; if (serverError != null) { if (serverError.GetHttpCode() == 404) { Server.ClearError(); Server.Transfer("~/error/NotFound.aspx"); } Server.Transfer("~/error/Default.aspx"); } } </code></pre> <p>The same results are present for this :( My final attempt was to apply this to the web config:</p> <pre><code>&lt;system.webServer&gt; &lt;httpErrors existingResponse="PassThrough" /&gt; &lt;/system.webServer&gt; </code></pre> <p>With this I just get a plain white screen with nothing on it... Any thoughts or comments would be greatly appreciated!! Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload