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

bal*_*dre 3 c# asp.net-mvc-3

可能重复:
如何从服务器端获取Url Hash(#)

我在从变量中获取哈希值时遇到了一些麻烦.

我正在使用默认操作 AccountController

[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl) { ... }
Run Code Online (Sandbox Code Playgroud)

但如果我通过此链接:

http://localhost:1357/none/Account/LogOn?returnUrl=a/b/c#day-22
Run Code Online (Sandbox Code Playgroud)

我永远无法抓住#day-22价值

下面是登录后的断点:

在此输入图像描述

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

如何使用哈希部分将用户转发到正确的URL ?

drc*_*rch 5

你需要对它进行urlencode.

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