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

AJ琼斯

目前页面重定向不起作用。页面 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");
    }
哔叽

您正在使用 ajax 调用 PasswordRequest 操作,ajax 会忽略所有重定向并始终返回成功:或错误 javascript 函数。如果要在控制器内部使用重定向,则必须使用提交按钮或 ancor 标签来调用 PasswordRequest。另一种方法是在成功的ajax函数内部分配window.location.href =http://localhost:40823/Account/SignIn。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章