Asp.net mvc 4 当前上下文中不存在名称Recaptcha
我正在尝试验证Google RecaptchaAsp.net mvc 4 当前上下文中不存在名称Recaptcha,asp.net-mvc-4,mvcrecaptcha,Asp.net Mvc 4,Mvcrecaptcha,我正在尝试验证Google Recaptcha 我添加了dll 实现了设计 在验证时,我收到了错误: 当前上下文中不存在名称Recaptcha [HttpPost] 公共行动结果提交() { if(ReCaptcha.Validate(privateKey:)) { 返回内容(“有效验证码”); } 其他的 { 返回内容(“无效验证码”); } } 如果您还没有,您可能需要查看以下内容:Microsoft.Web.Helpers.dll中发生了类型为“System.MethodAccessExc
[HttpPost]
公共行动结果提交()
{
if(ReCaptcha.Validate(privateKey:))
{
返回内容(“有效验证码”);
}
其他的
{
返回内容(“无效验证码”);
}
}
如果您还没有,您可能需要查看以下内容:Microsoft.Web.Helpers.dll中发生了类型为“System.MethodAccessException”的异常,但未在用户代码中处理。我现在收到此问题其他信息:尝试使用方法“Microsoft.Web.Helpers.ReCaptcha.GetHtmlWithOptions”(System.String,System.Object)“访问方法”System.Web.WebPages.WebPageContext.get_HttpContext()“失败。
[HttpPost]
public ActionResult Submit()
{
if (ReCaptcha.Validate(privateKey: "<private key>"))
{
return Content("Valid Captcha");
}
else
{
return Content("InValid Captcha");
}
}