« Previous Next »

Thread: Why are my relative paths different when I request the file name opposed to directory?

Last post 10-09-2009 10:24 PM by serverintellect_sw. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 10-08-2009, 7:46 AM

    • McDotNet
    • Not Ranked
    • Joined on 09-10-2008, 12:41 PM
    • Posts 8

    Why are my relative paths different when I request the file name opposed to directory?

    I am rewriting the url http://www.tworiverstaines.co.uk to http://www.tworiverstaines.co.uk/TwoRivers/ using this rule:
                   <rule name="tworiverstaines.co.uk" stopProcessing="false">
                        <match url="(.*)" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{PATH_INFO}" negate="true" pattern="^.?TwoRivers/.*" />
                            <add input="{HTTP_HOST}" pattern="^www.tworiverstaines.co.uk$" />
                        </conditions>
                        <action type="Rewrite" url="TwoRivers/{PATH_INFO}" />
                    </rule>

    I am using the tilde ~ in all the relative links for my web controls. 

    When I navigate to http://www.tworiverstaines.co.uk/ all the paths in the default document are:
    href="Filename.aspx" which is what I want.

    When I navigate directly to the file http://www.tworiverstaines.co.uk/Default.aspx all the paths are: href="TwoRivers/Filename.aspx" which results in the subfolder being shown in the browser address bar when clicking this link, which I do not want.

    Does anyone know why the paths change?

  • 10-09-2009, 10:24 PM In reply to

    Re: Why are my relative paths different when I request the file name opposed to directory?

    Hello mcdotnet,

    There was a known bug that would cause the ~ operator to be resolved incorrectly.

    You can find the solution on the following iis.net article:

    http://learn.iis.net/page.aspx/517/url-rewriting-for-aspnet-web-forms/#Using_tilda

    Hope that helps!

    Shaun Westling
    Technical Support Representative
    www.serverintellect.com

    Managed Servers, 24x7 U.S. Support, Web Hosting Solutions.
Page 1 of 1 (2 items)
Microsoft Communities