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

说代码转换为的Response.Redirect与#锚,不能在IE7工作

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

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

为什么IE7将我的锚?

编辑:我应该提到我与jQuery UI的选项卡控件一起使用它。我想要回发标签到特定的选项卡。

+0

您可以验证IE7越来越真实的URL(例如从HTTP请求),但下降的哈希值? (例如你是否安装了Fiddler2(或类似的)?) – scunliffe 2009-01-01 15:19:23

+0

scunliffe - 我已经安装了fiddler2,但我对这个工具很新,我无法弄清楚你的问题的答案。不过,我想感谢你向我推荐这个工具 - 我曾听说过这个工具,但是你促使我真正了解它并看到它的价值。 – dfasdljkhfaskldjhfasklhf 2009-01-02 11:21:33

回答

1

这将是相当黑客,但如果IE不行为,你可以做到这一点。

也传递参数,例如,

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

然后在网页上(人体接近标记之前,或作为onload事件),只为IE,提取参数(如果存在)和手动设置的哈希。

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

document.location.hash ='<%= Request [“hash”]%>'; 工作,谢谢 - 改为上面的代码。 如果我server.transfer这个 - 我可以隐藏网址杂乱 - 毕竟我只是回来ui更新,你知道是否有任何暗示吗? – dfasdljkhfaskldjhfasklhf 2009-01-02 11:20:06

0

我用RegisterClientScriptBlock发出window.location

事情是这样的:

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);