1

我最近搬到了 MVC4 并且我很难更改控制器中的 Recaptcha 以便它可以使用 Json 例如这个工作

 //This Works
 [HttpPost]
    public ActionResult create(Registration registration)
    {
        if (!ReCaptcha.Validate(privateKey: "key-value"))
        { return Content("Wrong Captcha please try again"); }


    }
 // This does not work it gives an error saying
[HttpPost]
    public JsonResult create(Registration registration)
    {

        if (!ReCaptcha.Validate(privateKey: "key-value"))
        { return Content("Wrong Captcha please try again"); }


    }

无法将类型'System.Web.Mvc.ContentResult'隐式转换为'System.Web.Mvc.JsonResult'
这是我切换到Json时遇到的错误有什么办法可以纠正吗?

4

0 回答 0