gpt4 book ai didi

asp.net - IIS 中重写规则中的多个条件

转载 作者:行者123 更新时间:2023-12-02 06:50:41 25 4
gpt4 key购买 nike

我在配置文件中的 asp.net mvc 应用程序中有一个重写规则:

<rule name="Website1" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(www.)?website1.com" />
<add input="{PATH_INFO}" pattern="^/website1/" negate="true" />
</conditions>
<action type="Rewrite" url="\website1\{R:0}" />
</rule>

在这种情况下,规则如何在两个条件下工作?两个条件都必须为真?

最佳答案

是的,两个条件都必须为真。

Rule Conditions

Conditions are defined within a collection of a rewrite rule. This collection has an attribute called logicalGrouping that controls how conditions are evaluated. If a rule has conditions, then the rule action will be performed only if rule pattern is matched and:

  • All conditions were evaluated to true, provided that logicalGrouping="MatchAll" was used.
  • At least one of the conditions was evaluated to true, provided that logicalGrouping="MatchAny" was used.


Doc 不是很清楚默认使用哪个逻辑分组,但我可以说它是 MatchAll .

换句话说, <conditions><conditions logicalGrouping="MatchAll"> 相同.

关于asp.net - IIS 中重写规则中的多个条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45203705/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com