如何使用web.config中的URL重写进行重定向?

时间:2019-05-14 11:39:18

标签: c# iis web-config

我正在尝试将网址重写规则添加到网站根文件夹中的* .json中。

  

检查标头进行身份验证,如果没有标头,则重定向。

<rule name="RequestBlockingRule1" stopProcessing="true">
<match url="^(.json)" />
<conditions>
<add input="{HTTP_X_Requested_With}" pattern="com.example.app" negate="true" />
</conditions>
<action type="Redirect" url="https://www.example.com/error.json" />
</rule>

但是它也适用于子文件夹内的所有json。如何仅选择根文件夹中的* .json?谢谢

0 个答案:

没有答案
相关问题