根据提供的路径重定向到不工作的操作



当前页面重定向不工作。该页面的URL是http://localhost:40823/Account/SignIn。页面根本没有重定向。我不知道为什么这个方法没有重新路由。什么好主意吗?我设置了一个断点,并遍历了我的代码,它到达了返回语句,但它不起作用。我在其他地方用过这个,它工作得很好。我只是复制了这里的返回语句,但它不起作用。

[HttpPost]
public ActionResult PasswordRequest(string email)
{
Player player= GetPlayer();
try
{
player.Email = Login.EmailAddress = email;
ResetPassword(player);
}
catch(Exception ex) {
console.log("Error")
}
return RedirectToAction("SignIn", "Account");
}

您正在使用ajax调用PasswordRequest操作,ajax忽略所有重定向,总是返回成功或错误的javascript函数。如果你想在控制器内部使用重定向,你必须使用提交按钮或锚标记来调用PasswordRequest。另一种方法是在success ajax函数中赋值window.location.href =http://localhost:40823/Account/SignIn。

最新更新