ASP.Net: Set custom error page for 400 bad request in IIS

sds
 
on Dec 12, 2021 07:59 PM
1816 Views

Hi

How can i add a new status code for 400 error.

I added in the iis Error Pages -> Add -> 400-> File Path -> D:\Source Code\abc\abc\error.htm

But still ' HTTP Error 400. The request URL is invalid' is showing.

Thank you

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Dec 12, 2021 10:56 PM
on Dec 13, 2021 05:47 AM

You cannot customize the following HTTP error messages: 400, 403.9, 411, 414, 500, 500.11, 500.14, 500.15, 501, 503, and 505.

Refer Configuring HTTP Error Responses for more details.

So it's not possible with IIS.

You can refer the below link as an alternative.

https://serverfault.com/questions/257680/properly-handle-iis-request-with-percent-sign-in-url