3

我想将查询字符串值从 url 传递到表单身份验证中的默认登录 url 页面。关于如何实现这一点的任何想法。搜索了一圈,没有发现任何有用的东西。谢谢。

4

2 回答 2

2

FormsAuthentication.RedirectToLoginPage("额外查询字符串");

MSDN

于 2013-05-27T13:43:23.083 回答
0

这对我有用:

网络配置:

<authentication mode="Forms">
    <forms loginUrl="~/Account/MyLogOn" timeout="30"...  />
</authentication>

控制器:

[AllowAnonymous]
public ActionResult MyLogOn(string aValue)
{
    //aValue contains my querystring: 12345
    return RedirectToAction("Action", "Controller", new {AValue = aValue});
}

网址:

http://mysite/?aValue=12345
于 2018-11-06T11:43:05.490 回答