Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom error page configured in IIS for code 400 (bad request) is ignored

For my website I configured some custom error pages. If I generate a 404, the redirect works fine. When hitting a 400, the "bad request" text shows up instead of the configured URl.

As a test I copied the URL from 404 to 400. No change. Then I changed the redirect to a file. No change.

Any ideas?

like image 243
Boris Callens Avatar asked Nov 06 '08 12:11

Boris Callens


3 Answers

I've run in to the same problem, and found this on msdn http://msdn.microsoft.com/en-us/library/ms690497.aspx

I'm not sure if this will work on IIS6, but it certainly works on IIS7. You need to configure httpErrors, not the custom errors

<system.webServer>
      <httpErrors errorMode="Custom">
            <error statusCode="400" subStatusCode="-1" path="_path" responseMode="Redirect" />
      </httpErrors>
</system.webServer>
like image 98
Nikita Ignatov Avatar answered Sep 21 '22 10:09

Nikita Ignatov


Maybe this is your answer: this Microsoft site says re configuring custom errors in IIS6 that

The following errors are not customizable: 400, 403.9, 411, 414, 500, 500.11, 500.14, 500.15, 501, 503, and 505.

like image 35
DOK Avatar answered Sep 21 '22 10:09

DOK


Try

Response.TrySkipIisCustomErrors = true;

OR

<configuration>
  <system.webServer>
    <httpErrors existingResponse="PassThrough" />
  </system.webServer>
</configuration>

original post

like image 45
Roman O Avatar answered Sep 20 '22 10:09

Roman O