.net Redirecttoaction正在返回登录页面
我有一个登录页面,用户可以选择忘记密码链接,然后允许用户更改密码。当用户生成/更改新密码时,用户应登录,而不是返回登录页面。为此,我使用redirectiontoaction对方法(即我的示例中的仪表板)执行操作。但是控件正在返回到登录页面。 这是我的密码:.net Redirecttoaction正在返回登录页面,.net,asp.net-mvc,redirecttoaction,.net,Asp.net Mvc,Redirecttoaction,我有一个登录页面,用户可以选择忘记密码链接,然后允许用户更改密码。当用户生成/更改新密码时,用户应登录,而不是返回登录页面。为此,我使用redirectiontoaction对方法(即我的示例中的仪表板)执行操作。但是控件正在返回到登录页面。 这是我的密码: [HttpPost] public ActionResult LogOn(Login.LoginModel model, string returnUrl) { //some code here and in th
[HttpPost]
public ActionResult LogOn(Login.LoginModel model, string returnUrl)
{
//some code here and in the end redirect as shown below
return RedirectToAction("Index", "Conroller1", new { Area = "" });
}
然后,登录页面在浏览器的地址栏中显示此信息
http://localhost:8888/Login/Login?ReturnUrl=%2FConroller1%2FIndex
这是我的web.config
<authentication mode="Forms">
<forms loginUrl="~/Login/Login" timeout="35"/>
</authentication>
如何解决这个问题?请引导我完成。您设置了身份验证cookie吗?马特-它就像一个符咒。但是,我需要知道FormsAuthentication.SetAuthCookie(用户名,true)的用途;这就是我所做的字符串user=Session[“UserName”].ToString();FormsAuthentication.SetAuthCookie(用户,true);用户更新密码后,您可以在确认其凭据后手动登录。FormsAuthentication.SetAuthCookie(用户名,true)与选中“记住我”框FormsAuthentication相同。SetAuthCookie(用户名,false)意味着您需要在会话退出后重新登录。