【问题标题】:IIS CustomError redirect lacks ContentType header, blocked by firewallIIS 自定义错误重定向缺少内容类型标头,被防火墙阻止
【发布时间】:2012-05-27 22:05:31
【问题描述】:

我的 web.config 中的 CustomErrors 指令正在工作,除了 404 之外,IIS 提供没有 ContentType 标头的 302 重定向。这会导致防火墙阻止响应,并且客户端永远不会访问自定义错误页面。注意我使用的是 IIS7、MVC (razor)、ELMAH,并且支持各种浏览器。

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

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

【问题讨论】:

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


    【解决方案1】:

    您可以尝试像此人在此处所做的那样编写自定义 HTTP 模块:

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

    【讨论】:

    • 谢谢,看起来它与 ELMAH 交互可能有问题,所以我没有优先尝试,但如果/当我这样做时,我会在这里报告。
    猜你喜欢
    • 1970-01-01
    • 2019-04-07
    • 2014-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多