4

I am using WebAPI2 and I have a route "Products/{Id}/details". When Id contains \ , IIS changes it to /. For example pr\p is changed to pr/p and it "spoils" the uri. I want to know how to prevent changing ** to **/, or are there any other workarounds?

Thanks in advance for your help.

Sargis Koshkaryan
  • 1,012
  • 3
  • 9
  • 19

1 Answers1

1

This looks useful:

<rule name="KeepBackslashes" stopProcessing="true">
    <match url="(.*)" />
    <action type="Rewrite" url="http://HOST:PORT/{UrlDecode:{C:1}}" logRewrittenUrl="true" />
    <conditions>
        <add input="{UNENCODED_URL}" pattern="/(.*?)($|\?)" />
    </conditions>
</rule>
Cees Timmerman
  • 17,623
  • 11
  • 91
  • 124