Home IIS.NET Forums IIS 7 and Above General custom error pages
Last post Jan 21, 2021 05:37 PM by Rovastar
25 Posts
Jan 18, 2021 08:17 AM|EyalD|LINK
Hi All
we have a custom error pages in our sites.
for some reason when opening dev tools (in browser) the error pages that configured as aspx returns 404 but the htm\html pages returns 200.
why is that?
thanks
E
220 Posts
Jan 19, 2021 02:25 AM|Brucz|LINK
Hi EyalD,
If you set the responseMode is ExecuteURL, it will return 200. Because it is also a request for error page.
<httpErrors errorMode="Custom"> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="/404.html" responseMode="ExecuteURL" /> </httpErrors>
Set the responseMode to File will make status code to 404, not 200.
<httpErrors errorMode="Custom"> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="404.html" responseMode="File" /> </httpErrors>
Best regards,
Brucz
5494 Posts
MVP
Moderator
Jan 21, 2021 05:37 PM|Rovastar|LINK
Because IIS errors (html pages, etc). and asp.net errors handling are very different beasts. You will need to configure both to have a complete site.
25 Posts
custom error pages
Jan 18, 2021 08:17 AM|EyalD|LINK
Hi All
we have a custom error pages in our sites.
for some reason when opening dev tools (in browser) the error pages that configured as aspx returns 404 but the htm\html pages returns 200.
why is that?
thanks
E
220 Posts
Re: custom error pages
Jan 19, 2021 02:25 AM|Brucz|LINK
Hi EyalD,
If you set the responseMode is ExecuteURL, it will return 200. Because it is also a request for error page.
<httpErrors errorMode="Custom"> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="/404.html" responseMode="ExecuteURL" /> </httpErrors>
Set the responseMode to File will make status code to 404, not 200.
<httpErrors errorMode="Custom"> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="404.html" responseMode="File" /> </httpErrors>
Best regards,
Brucz
5494 Posts
MVP
Moderator
Re: custom error pages
Jan 21, 2021 05:37 PM|Rovastar|LINK
Because IIS errors (html pages, etc). and asp.net errors handling are very different beasts. You will need to configure both to have a complete site.
https://www.leansentry.com/