【问题标题】:ASP.NET URL rewrite rule that ignores AJAX requests忽略 AJAX 请求的 ASP.NET URL 重写规则
【发布时间】:2014-11-23 05:37:22
【问题描述】:

我将如何创建一个强制小写 URL 的 URL 重写规则,除非请求是 AJAX 请求,即当标头 X-Requested-With 具有 XMLHttpRequest 的值时?

【问题讨论】:

    标签: asp.net ajax iis url-rewriting


    【解决方案1】:

    想通了。

            <rule name="LowerCaseURL" stopProcessing="true">
                <match url="[A-Z]" ignoreCase="false" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{HTTP_X_Requested_With}" pattern="^XMLHttpRequest$" negate="true" />
                </conditions>
                <action type="Redirect" url="{ToLower:{URL}}" />
            </rule>
    

    【讨论】:

      猜你喜欢
      • 2011-06-14
      • 1970-01-01
      • 2012-02-13
      • 1970-01-01
      • 2013-09-27
      • 2018-11-13
      • 1970-01-01
      • 2014-11-30
      • 1970-01-01
      相关资源
      最近更新 更多