如何在回发后读取/写入或保留片段标识符 [英] How to Read / Write or Preserve Fragment Identifiers on Post-back
问题描述
我正在使用片段标识符来运行选项卡式浏览控件,并且如果回发可以保留选项卡,那会很好,因为这样对用户的影响较小.为此,我一直在寻找一种方法来保存片段标识符,并且全神贯注.
I'm using fragment identifiers to run a tabbed browsing control and it would be nice if the post-back could preserve the tab as that is less jarring to the user. To that end I've been searching for a method to preserve the fragment identifier and am at a total loss.
在ASP.NET中的页面回发期间,是否有办法从引用URL中读取或保存片段标识符?
Is there a way to read or save the fragment identifier from the referring url during a page post-back in ASP.NET?
推荐答案
您无法在服务器端保存/检索URL片段,因为浏览器不会将它们发送给服务器(也不应发送给服务器). 请参阅此处.
You can't save/retrieve URL fragments on the server side because Browsers don't send them -and they aren't supposed to- to the server. See here.
客户端不应在检索文档时将URI片段发送到服务器,并且在没有本地应用程序帮助的情况下(请参见下文),片段不参与HTTP重定向.
Clients are not supposed to send URI-fragments to servers when they retrieve a document, and without help from a local application (see below) fragments do not participate in HTTP redirections.
这篇关于如何在回发后读取/写入或保留片段标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!