c# - 传递带有哈希值的 URL 以进行重定向

标签 c# asp.net-mvc-3

<分区>

Possible Duplicate:
How to get Url Hash (#) from server side

我在从变量中获取散列 值时遇到了一些问题。

我正在使用 AccountController 中的默认操作

[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl) { ... }

但如果我将此链接传递给:

http://localhost:1357/none/Account/LogOn?returnUrl=a/b/c#day-22

我永远无法捕捉到 #day-22

下面是登录后的断点:

enter image description here

我从来没有得到 HttpContext.Request.Url 对象的哈希值。

What can I do to forward the user to the correct URL with the hash part?

最佳答案

你需要对其进行urlencode。

尝试:http://localhost:1357/none/Account/LogOn?returnUrl=a/b/c%23day-22

关于c# - 传递带有哈希值的 URL 以进行重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12053096/

相关文章:

asp.net-mvc-3 - MVC 3 DropDownList 重定向到 Diff 操作 OnChange?

c# - 编译器返回一个整数而不是 double

c# - 搜索 List<Items> 然后更改为 List<ItemType : Item>

c# - Nunit 2.6 + Resharper 7 +NCrunch + visual studio 2010

c# - 在另一个模型中利用模型方法和属性

c# - 在 MVC 3 中禁用局部 View 缓存

c# - WPF - Graphics.CopyFromScreen 返回黑色图像

c# - 使用 C# 使用 GZipStream 类对包含子目录的目录进行 Gzip 压缩?

c# - 领域模型上的切换逻辑

jquery - 使用 $.ajax 获取部分 View