0
我试图得到returnURL,但可能我错过了一些东西。该webconfig是:LogIn.cshtml的返回url为null,如何得到它
<authentication mode="Forms">
<forms loginUrl="~/UserAccount/Login" timeout="2880" />
</authentication>
<authorization>
<allow users="?" />
</authorization>
部分是:登录方法的
@model Models.UserModel
@{
// ViewBag.Title = "Home Page";
}
@using (Html.BeginForm("LogIn", "UserAccount", new { ReturnUrl = Request.QueryString["ReturnUrl"] }, FormMethod.Post))
{
<div>
<table>
和部分:
[HttpGet]
public ActionResult LogIn(string ReturnUrl)
{
ViewBag.ReturnUrl = ReturnUrl;
var model = new UserModel();
return View(model);
}
[HttpPost]
public ActionResult LogIn(UserModel model, string returnUrl)
{
if (!ModelState.IsValid)
我还以为是我必须做的一切将returnURL获取到LogIn方法,但不起作用。我做错了什么? 谢谢。
ReturnUrl将为空,您将间接访问“LogIn”页面。 – romanoza