的方法,当用户试图访问认证页面,它会被重定向到登录页面。以下是登录操作:RETURNURL参数不传递给发布LogOn支持行动
控制器动作
[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
//Authentication codes goes here .......
}
LogOn支持查看:
@using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { @class = "jmenu" }))
{
// Form for login codes goes here......
}
问题: 根据登录查看时,我并没有把参数在HTML中.BeginForm()它可以正常工作。登录后页面被重定向到页面,用户被重定向到登录进行认证。但是,如果我像上面那样传递参数,那么在登录后它将被重定向到主页。在这里,可能是由于returnUrl没有传递给LogOn操作。如何在Html.BeginForm中为LogOn操作传递returnUrl参数。或者,是否可以在不改变视图和修改LogOn操作的情况下进行修改,以便我不必为其他视图的代码进行更改。感谢您的时间...
试试这个 http://stackoverflow.com/questions/9144930/asp-net-mvc-returnurl-variable-not-showing-up-with-method-formmethod-post-in-htm – Tushar 2013-07-29 12:31:15