IIS CustomError redirect lacks ContentType header, blocked by firewall
-
11-06-2021 - |
Вопрос
The CustomErrors directive in my web.config is working, except that for 404's, IIS serves a 302 redirect with no ContentType header. This causes firewalls to block the response, and clients never get to the custom error page. Note I'm using IIS7, MVC (razor), ELMAH, and support various browsers.
<customErrors defaultRedirect="~/Site/Error" mode="RemoteOnly" />
How can I get my a reasonable Content-Type header on all my CustomError redirections, or otherwise fix the problem?
Решение
You could try writing a custom HTTP module like this person did here:
Не связан с StackOverflow