IIS自定义错误重定向缺少内容类型标头,被防火墙阻止

时间:2012-05-27 22:05:31

标签: iis iis-7 content-type custom-errors custom-error-pages

我的web.config中的CustomErrors指令正在运行,但对于404,IIS提供302重定向而没有ContentType标头。这会导致防火墙阻止响应,客户端永远不会进入自定义错误页面。注意我使用的是IIS7,MVC(razor),ELMAH,并支持各种浏览器。

<customErrors defaultRedirect="~/Site/Error" mode="RemoteOnly" />

如何在所有CustomError重定向上获取合理的Content-Type标头,或以其他方式解决问题?

1 个答案:

答案 0 :(得分:1)

您可以尝试编写一个自定义HTTP模块,就像这个人在这里做的那样:

http://www.colincochrane.com/post/2008/01/ASP-NET-Custom-Errors-Preventing-302-Redirects-To-Custom-Error-Pages.aspx

相关问题