c# - 如何使用 C# 在 URL 中检索 # 之后的值

标签 c# asp.net ajax

我正在尝试实现 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/

相关文章:

c# - Model.(Variable) 是做什么的?

c# - UnmanagedExports 函数参数 - 导致 VBA 49 错误的 DLL 调用约定

c# - 如何在 C# 中从 ASP.NET MVC Controller 调用静态方法

c# - 如果我的 C# 程序中没有任何按键,如何进入登录表单?

javascript - 在 html 类型 ='button' 内发送数据

javascript - NodeJS 到客户端 : large data sending performance

jquery - 每次 PJAX 表单更新时重复查询字符串参数 - 414 Request-URI Too Large

c# - 使用具有不同类型详细信息的主从 View

asp.net - ASP.NET Web 门户的多种解决方案布局?

c# - 获取相对路径的绝对路径