0

ディスクキャッシュ機能とsqldatareaderでImageresizerを使用しようとしています。URL は次の形式であると想定されます。

http://somesite.com/image/ {imageid}.{extension}

一方、私たちのサイトのすべての画像リンクは現在次のとおりです。

http://somesite.com/image.aspx?imageid= {imageid}&format={extension}

これらを変換するためにこれまでに見つけた最良の解決策は UrlRewrite ですが、意図したこととは逆のことを行っています (ナイスな URL を厄介な URL にします)。私はこれに対して正しい書き換え規則を得るのに苦労しており、誰かが助けてくれることを望んでいました. 以下は私が現在持っているものであり、完全に間違っている可能性があることを認識しています。

 <rewrite>
     <rules>
         <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
             <match url="^image.aspx?([^imageid=]+)$" ignoreCase="true" />
             <conditions>
                 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="false" />
                 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
             </conditions>
             <action type="Rewrite" url="image/{R:1}.jpg" />
         </rule>
     </rules>
  </rewrite>
4

1 に答える 1

0

次のルールで基本的な機能を動作させることができました。

<rule name="Redirect Category Name and Sort By" stopProcessing="true">
    <match url="^image\.aspx$" ignoreCase="true" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="true">
        <add input="{QUERY_STRING}" pattern="^imageid=([0-9]+)" />
    </conditions>
    <action type="Rewrite" url="image/{C:1}.jpg" appendQueryString="true" />
</rule>
于 2013-09-01T17:45:10.083 に答える