Response.Redirect C # anchor, not working in IE7

Response.Redirect(string.Format("myprofile.aspx?uid={0}&result=saved#main",user.UserID));

      

the specified code is converted to

IE7 -myprofile.aspx?uid=933fdf8e-1be0-4bc2-a269-ac0b01ba4755&result=saved

FF -myprofile.aspx?uid=933fdf8e-1be0-4bc2-a269-ac0b01ba4755&result=saved#main

why is IE7 dropping the anchor?

edit: It should be mentioned that I am using this in conjunction with the jQuery UI tab control. I want the postback to go to a tab.

0


source to share


3 answers


This is going to be pretty hacky, but if IE isn't behaving, you can do it.

pass also a parameter like

uid=933fdf8e-1be0-4bc2-a269-ac0b01ba4755&result=saved&hash=main#main

      



Then in your page (before the body close tag or onload event), IE only, extract the parameter if present and set the hash manually.

<!--[if IE]>
<script>
  if(document.location.href.indexOf('&hash=') != -1){
    //extract value from url...
    document.location.hash = extractedValue;
  }
</script>
<![endif]-->

      

+1


source


Perhaps this is a regression issue from IE6?



Have you tried working around it by adding it with &?

+1


source


I used RegisterClientScriptBlock

to release window.location

.

Something like that:

string url = String.Format("{0}RegForm.aspx?regId={1}#A", this.CurrentFolderUrl, this.RegId);

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "redirectToClientPage", String.Format("window.location='{0}'", url), true);

      

0


source







All Articles