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