Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internet Explorer ignores Hashtag in URL

I've got the following URL Rewrite Rules set up:

<rules>
            <rule name="Clean URL" stopProcessing="true">
                <match url="^([A-Za-z0-9]+)([\?A-Za-z0-9#=&amp;]+)?$" />
                <action type="Rewrite" url="{R:1}.aspx{R:2}" />
            </rule>
            <rule name="CleanTest" stopProcessing="true">
                <match url="^([a-z0-9/]+).aspx([a-zA-Z0-9\?#=&amp;]+)?$" />
                <action type="Redirect" url="{R:1}{R:2}" />
            </rule>
        </rules>

What this does is show a clean (non-.aspx) URL in the client's address bar and additionally redirects every clean URL call to the corresponding .aspx-Page. This "generally" works fine. However, when my URL includes a hashtag, i.e. Administration.aspx#first the hashtag is missing after the redirection in IE only, it works perfectly fine in FF/Chrome, what could cause this?

Result after clicking on the Link in Chrome/FF:

Administration#first

Result in IE (9):

Administration

Addendum: It works perfectly fine for GET-Parameters.

Link: Login.aspx?logout=1

IE: Login?logout=1

FF/Chrome: Login?logout=1

like image 410
Dennis Röttger Avatar asked Mar 14 '12 12:03

Dennis Röttger


1 Answers

As the hashtag is mainly is for the browser on the client side to know where to scroll within a page, it seems logical to me that not all browsers send it to the server. However I am not sure what the specification says about it.

like image 175
jabal Avatar answered Oct 25 '22 21:10

jabal