IIS 7 rewrite rules and issues with Url.Content

I have the following rule in IIS 7:

           <rule name="Category" enabled="true">
              <match url="^store/([0-9]+)/(.*)" />
              <action type="Rewrite" url="store?cid={R:1}" appendQueryString="false" logRewrittenUrl="true" />
           </rule>

Which seems to work fine, however, in my ASP.Net MVC 3 application, I have some @ Url.Content ("~ /") entries that allow / store / as root as opposed to /. A typical URL would be http://mysite.com/store/99/coats-with-hoods , for example.

EDIT / UPDATE: I still keep my hair on this, so I decided to look in the Url.Content code base, and I noticed that it checks if the URL has been rewritten (true), and if so it makes the appropriate path, which, in turn, gives a non- absolute URL:

    if (!PathHelpers._urlRewriterHelper.WasRequestRewritten(httpContext))
      return contentPath;
    string relativePath = PathHelpers.MakeRelative(httpContext.Request.Path, contentPath);
    return PathHelpers.MakeAbsolute(httpContext.Request.RawUrl, relativePath);

Does anyone know why this would be? I'm a little confused why this is happening and how can I explain this in my application?

+3
2

, , IIS ASP.Net MVC, HttpContext.RewritePath , , .

, Url.Content, , , /store//.

+2

/ (, ~/ site.com/), ~ URL- /path/to/content. ~ - .

+1

All Articles