【发布时间】: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