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#=&]+)?$" />
<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\?#=&]+)?$" />
<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?
这样做是在客户端的地址栏中显示一个干净的(非.aspx)URL,并将每个干净的URL调用重定向到相应的.aspx-Page。这“通常”工作正常。但是,当我的URL包含一个#标签,即Administration.aspx#时,首先在IE中重定向后缺少hashtag,它在FF / Chrome中完全正常,这可能是什么原因导致的?
Result after clicking on the Link in Chrome/FF:
单击Chrome / FF中的链接后的结果:
Administration#first
管理#第一
Result in IE (9):
IE(9)中的结果:
Administration
行政
Addendum: It works perfectly fine for GET-Parameters.
附录:它对GET参数完全正常。
Link: Login.aspx?logout=1
链接:Login.aspx?logout = 1
IE: Login?logout=1
IE:登录?logout = 1
FF/Chrome: Login?logout=1
FF / Chrome:登录?logout = 1
1 个解决方案
#1
2
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.
由于主题标签主要是为了让客户端的浏览器知道在页面中滚动的位置,因此我并不认为所有浏览器都不会将其发送到服务器。但是我不确定规范说的是什么。
#1
2
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.
由于主题标签主要是为了让客户端的浏览器知道在页面中滚动的位置,因此我并不认为所有浏览器都不会将其发送到服务器。但是我不确定规范说的是什么。