Response.Redirect with a fragment identifier causes unexpected refresh when later using location.has

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2009-12-31T11:30:40Z Indexed on 2010/03/11 5:08 UTC
Read the original article Hit count: 655

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:

  1. User visits A.aspx
  2. A.aspx uses Response.Redirect to bring the user to B.aspx#house
  3. 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:

  1. Page A must redirect to page B with a fragment identifier in the url
  2. Any user action on page B will set the location.hash
  3. Setting location.hash must not make page B refresh
  4. This must work on IE

Notes:

  1. Bug only repros on IE (tested on ie6|7|8). Opera, FF, Chrome, Safari all have the expected results of no reload.
  2. This error may have nothing to do with ASP.NET, and everything to do with IE
  3. 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

© Stack Overflow or respective owner

Related posts about fragment-identifier

Related posts about redirect