【发布时间】:2021-09-16 00:36:45
【问题描述】:
当前页面重定向不起作用。页面 URL 位于 http://localhost:40823/Account/SignIn。该页面根本没有重定向。我不知道为什么这种方法没有重新路由。有任何想法吗?我设置了一个断点并遍历了我的代码,它到达了 return 语句,但它不起作用。我在其他地方使用过它,它工作得很好。我只是在这里复制了 return 语句,但它不起作用。
[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");
}
【问题讨论】:
-
您是否尝试输入localhost:40823/Account/SignIn。在浏览器中?
-
@Serge 是的,我做到了。如果手动完成,它可以工作。
-
如何调用 PasswordRequest 操作?提交按钮还是别的什么?
-
“如果手动完成则不起作用”但如果它完全起作用?
-
@Serge 我在 JavaScript 中使用 fetch 调用。如果我设置了 window.location.href 它可以正常工作,但重定向操作将不起作用。
标签: c# asp.net asp.net-mvc asp.net-core