【问题标题】:URL rewrite outbound rules and custom error pagesURL 重写出站规则和自定义错误页面
【发布时间】:2013-06-13 15:30:25
【问题描述】:

我正在使用应用程序请求路由将博客代理到更大的网站。我正在使用以下规则重写 HTML 元素上基于 URI 的属性,以确保生成的 HTML 符合代理配置:

<rule name="HtmlContentRewrite" preCondition="HtmlContent" stopProcessing="false">
    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/([^/].*)" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
    <action type="Rewrite" value="/blog/{R:1}" />
</rule>

现在这对所有内容都非常有效,但自定义错误页面除外。自定义错误页面基本上是 /e/not-found 等处的 MVC 视图,但是重写器没有在自定义错误页面上执行它的工作,因此我的内容没有样式并且没有图像,无法加载这些资源.

有谁知道 URL 重写出站规则是否真的可以应用于自定义错误页面?如果没有,有什么建议的解决方法吗?

【问题讨论】:

    标签: asp.net asp.net-mvc iis url-rewriting custom-error-pages


    【解决方案1】:

    另一种选择是将您的自定义错误页面作为重定向到正常 URL 的重定向存根,以允许发生 URL 重写。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-28
      • 1970-01-01
      • 2023-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-10
      • 2015-10-23
      相关资源
      最近更新 更多