IIS url rewrite - flash对象/ param URL的小写出站规则条件

时间:2011-03-14 19:42:52

标签: .net iis url-rewriting

我有一个.NET 4.0项目并使用IIS 7.5网址重写规则在所有网址上强制执行小写 - 包括入站和出站规则。我根据需要提供了所有功能,但是对象参数标签值降低了:

    <object width="600" height="378" id="flash_258112502" type="application/x-shockwave-flash" data="/_resources/flash/videoplayer.swf">  
    <param value="rtmp://media.website.org/vod/mp4:20110302councilmeeting.f4v" name="serverurl"> 
</object>

这些用于Flash服务器的URL确实区分大小写,因此修改了它们的大小写功能。如何编写一个目标条件来排除这些网址被重写?

我的web.config重写出站规则如下,我试图添加自定义标签,以便能够匹配/对象或参数,但无济于事:

 <outboundRules rewriteBeforeCache="true">
    <!-- convert all links to lowercase -->
    <rule name="Outbound lowercase" preCondition="IsHTML" enabled="true">
      <match filterByTags="A, Script, CustomTags" customTags="object" pattern=".*[A-Z].*" ignoreCase="false" />
      <action type="Rewrite" value="{ToLower:{R:0}}" />
      <conditions logicalGrouping="MatchAny">
        <add input="{URL}" pattern="/workarea/" negate="true" />
        <add input="{URL}" pattern="media.website.org" negate="true" />
                    <add input="{URL}" pattern="^.*\.(ashx|axd|css|gif|png|js|flv|f4v)$" negate="true" /> 
      </conditions>
    </rule>
    <preConditions>
      <!-- Only process html files -->
      <preCondition name="IsHTML" logicalGrouping="MatchAny">
        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
      </preCondition>
    </preConditions>
            <customTags>
                <tags name="param">
                    <tag name="param" attribute="param" />
                </tags>
                <tags name="object" />
            </customTags>
  </outboundRules>

-my first stackoverflow post,拜托,谢谢!

1 个答案:

答案 0 :(得分:0)

规则不应包含对象,因为您不希望它匹配并获得小写

<match filterByTags="A, Script" pattern=".*[A-Z].*" ignoreCase="false" />

从这个开始

    <outboundRules>
        <rule name="Outbound LowerCase Rule">
            <match filterByTags="A" pattern=".*[A-Z].*" />
            <action type="Rewrite" value="{ToLower:{R:0}}" />
        </rule>
    </outboundRules>