URLRewriter.net fails relative paths when using more than one substring in URL
- by Andreas Strandfelt
Hi.
I have installed the URLRewriter on my server, and it works fine, but I have a rather big problem.
Relative links in hyperlinks, CSS-links, images etc. doesn't work when I have URLs with more than one substring.
E.g. (sorry, no http:// in front, as I do not have enough reputation):
dkbyg.strandweb.dk/Leje-og-udlejning-arbejdskraft leads to the path dkbyg.strandweb.dk/Workers.aspx and works just fine.
But
dkbyg.strandweb.dk/Leje-og-udlejning-arbejdskraft/Midtjylland leads to dkbyg.strandweb.dk/Workers.aspx?Region=Midtjylland using this line in the Web.config:
<rewrite url="~/Leje-og-udlejning-arbejdskraft/(.+)" to="~/Workers.aspx?Region=$1"/>
It rewrites just fine, but my relative links doesn't work anymore. CSS, Images, links and so on thinks my root is now http://dkbyg.strandweb.dk/Leje-og-udlejning-arbejdskraft, which of course doesn't exist.
Can't this be fixed?
All my links are correctly set using the ~/, like this:
<asp:HyperLink ID="HyperLink3" CssClass="black_text" NavigateUrl="~/Forgot-Password"
runat="server">I have forgotten my password</asp:HyperLink>