可能是重复的问题。我有一个SPA和实施的reCAPTCHA这我在本地主机上运行,并给我一个错误:“假\ nincorrect - 验证码 - 溶胶”。我使用的代码如下所示为从原始源here。它是用相同的密钥(私有和公有)前的工作。我应该怎么可能改变或检查,使工作?谢谢
var httpClient = new HttpClient();
var PK = ConfigurationManager.AppSettings["recaptchaKey"];//private key
var userIP = ((HttpContextBase)this.Request.Properties["MS_HttpContext"]).Request.UserHostAddress;
var uri = "http://www.google.com/recaptcha/api/verify";
var postData = new List<KeyValuePair<string, string>>();
postData.Add(new KeyValuePair<string, string>("privatekey", PK));
postData.Add(new KeyValuePair<string, string>("remoteip", userIP));
postData.Add(new KeyValuePair<string, string>("challenge", data.Challenge));
postData.Add(new KeyValuePair<string, string>("response", data.Response));
HttpContent content = new FormUrlEncodedContent(postData);
string responseFromServer = await httpClient.PostAsync(uri, content)
.ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode())
.ContinueWith((readTask) => readTask.Result.Content.ReadAsStringAsync().Result);
if (responseFromServer.StartsWith("true"))
{
return Contact(data);
}
按照你张贴到了错误的URL它siteverify,而不是在刚刚结束验证文档。 https://developers.google.com/recaptcha/docs/verify