【发布时间】:2013-12-09 22:42:34
【问题描述】:
我尝试了Response.Redirect("page.aspx#here"),但没有成功。
这是我的 aspx 文件中的代码:<a name="here"></a>我必须以不同的方式重定向到它吗?
【问题讨论】:
我尝试了Response.Redirect("page.aspx#here"),但没有成功。
这是我的 aspx 文件中的代码:<a name="here"></a>我必须以不同的方式重定向到它吗?
【问题讨论】:
这里接受的答案不正确。
我可以通过执行以下操作在 C# 中完成这项工作:
Response.Redirect("page.aspx" + "#here", false);
【讨论】:
您不能从服务器端代码重定向到锚点,因为锚点完全是客户端概念。为此,您必须使用 Javascript。见Retrieving Anchor Link In URL for ASP.Net。
【讨论】: