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.
source to share
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]-->
source to share
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);
source to share