我正在尝试实现 ajax 后退/前进按钮支持,因此在我的 url 中的 # 之后写入变量。我还希望用户能够复制 url,然后链接回它。有谁知道我如何解析 url 并获取我的“查询字符串”,即使它们在 # 后面?
最佳答案
散列后的值不会传输到服务器。在某个地方还有另一个 SO 问题,但我找不到它。同样,我花了一段时间才找到一个不错的引用文献,但是 this Wikipedia article有一些确认:
The fragment identifier functions differently than the rest of the URI: namely, its processing is exclusively client-side with no participation from the server. When an agent (such as a Web browser) requests a resource from a Web server, the agent sends the URI to the server, but does not send the fragment.
我假设您想在服务器端而不是浏览器端响应它? (鉴于你问的是用 C# 做...)
关于c# - 如何使用 C# 在 URL 中检索 # 之后的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/341029/