从Login View重定向到ASP.NET MVC4中的ChangePassword视图

1 c# asp.net-mvc asp.net-mvc-4

我正在创建一个非常简单的ASP.NET MVC4 Mobile应用程序,它需要一个登录页面,成功登录后,用户被重定向到登陆页面(订单列表).如果登录过程返回用户密码已过期的值,则用户将被重定向到"更改密码"页面.

我正在尝试将此重定向到"更改密码"页面,但由于某种原因,我总是被重定向回"登录"页面.我在控制器中使用此代码(主要来自VS2012中的MVC4 Web应用程序示例) -

public ActionResult Login(LoginModel model, string returnUrl)
{
...
if (retValue.Equals("ChangePassword"))
    RedirectToAction("ChangePassword", "Account");
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

请注意,ChangePassword视图与Login视图位于同一AccountContoller中.还有LoginModel和ChangePasswordModel.

mat*_*mmo 5

你需要return重定向.试试这个:

if (retValue.Equals("ChangePassword"))
    return RedirectToAction("ChangePassword", "Account");
Run Code Online (Sandbox Code Playgroud)