IIS url rewrite - lowercase outbound rule condition for flash object/param urls
I have a.net 4.0 project and am using IIS 7.5 url rewrite rules to enforce lowercase on all urls - both inbound and outbound rules. I have everything functional as desired but for the case of an object param tag value being lowered:
<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>
These urls for the flash server are indeed case sensitive and so modifying their case breaks functionality. How does one write a targeted condition to exclude these urls from being re-written?
My web.config re-write outbound rules are as follows, i have tried to add custom tags to be able to match /object or param but to no avail:
<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="me开发者_JAVA百科dia.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 , please and thanks!
The rule should not contain object as you don't want it to match and get lowercased
<match filterByTags="A, Script" pattern=".*[A-Z].*" ignoreCase="false" />
Start with this
<outboundRules>
<rule name="Outbound LowerCase Rule">
<match filterByTags="A" pattern=".*[A-Z].*" />
<action type="Rewrite" value="{ToLower:{R:0}}" />
</rule>
</outboundRules>
精彩评论