Response.Redirect with a fragment identifier causes unexpected refresh when later using location.has
- by Matt
Hi All,
I was hoping someone can assist in describing a workaround solution to the following issue I am running into on my ASP.NET website on IE. In the following I will describe the bug and clarify the requirements of the needed solution.
Repro Steps:
User visits A.aspx
A.aspx uses Response.Redirect to bring the user to B.aspx#house
On B.aspx#house, the user clicks a button that sets window.location.hash='test'
Actual Results:
B.aspx is loaded again. The URL now shows B.aspx#test
Expected Results:
No reload. The URL will just change to B.aspx#test
Requirements:
Page A must redirect to page B with a fragment identifier in the url
Any user action on page B will set the location.hash
Setting location.hash must not make page B refresh
This must work on IE
Notes:
Bug only repros on IE (tested on ie6|7|8). Opera, FF, Chrome, Safari all have the expected results of no reload.
This error may have nothing to do with ASP.NET, and everything to do with IE
For any kind soul willing to have a look at this, I have created a minimal ASP.NET web project to make it easy to repro here