微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 IIS url 重写ASP NET Core中添加异常?

如何解决如何在 IIS url 重写ASP NET Core中添加异常?

我有规则:

 <rule name="main" stopProcessing="true">
      <match url="main/([^.]*)/$" />
      <action type="Redirect" url="/main/" appendQueryString="false" redirectType="Permanent" />
 </rule>

引用 /main/xxxx/ 转到 /main/,但我需要使用一个没有重定向的引用 (/main/docs/) 来制定规则。

帮助我,请在规则中破例

解决方法

引用 /main/xxxx/ 转到 /main/,但我需要使用一个没有重定向的引用 (/main/docs/) 来制定规则。

要达到要求,您可以尝试add a condition to the rule,如下所示。

<rule name="main" stopProcessing="true">
    <match url="main/([^.]*)/$" />
    <conditions>
        <add input="{REQUEST_URI}" pattern="main/doc/" negate="true" />
    </conditions>
    <action type="Redirect" url="/main/" appendQueryString="false" redirectType="Permanent" />
</rule>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。