Inbound urls are relative to web.config, as is told here:
http://learn.iis.net/page.aspx/465/url-rewrite-module-configuration-reference/
But something similar doesn't seem to work for outbound urls; I always have to give the full absolute path including the root webapps path.
For example:
I have a webapp running under http://example.com/myApp/
I want
http://example.com/myApp/product.aspx?id=123
to be mapped to
http://example.com/myApp/product/123
Then the inbound url rule would be:
<rule>
<match url="product/(\d+)" />
<action type="Rewrite" url="product.aspx?id={R:1}" />
</rule>
As outbound rule, I would expect something like:
<outboundRules>
<rule name="Model" patternSyntax="ECMAScript" stopProcessing="false" preCondition="">
<match filterByTags="A" customTags="" pattern="product\.aspx\?id=([0-9]+)" ignoreCase="true" negate="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" value="product/{R:1}" />
</rule>
</outboundRules>
But when the current browser url is http://example.com/myApp/product/123 this wil result in urls like:
http://example.com/myApp/product/product/456 (double times the string "product")
When putting a / in front of the action value, this will result in:
http://example.com/product/456 (without the "myApp" webapp root).
Using "~/product/{R:1}" also doesn't work.
Is there a solution to use the action value pattern without a hardcoded webapp root ("myApp")? like is possible for inbound urls.