0
可能是重複的問題。我有一個SPA並執行reCaptcha,我在本地主機上運行並給了我一個錯誤:「false \ nincorrect-captcha-sol」。我使用的代碼顯示如下,原始來源here。它以前使用相同的密鑰(私人和公共)工作。我應該怎麼可能改變或檢查,使工作?謝謝reCaptcha始終返回false
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);
}
我之前更改了前面提到的網址,但只有這個錯誤:「\ n \」success \「:false,\ n \」error-codes \「:[\ n \」invalid-輸入響應\「 \ n \‘缺少輸入祕密\’\ n] \ n}」 – mboko
你沒有通過正確的領域上POST 正確的字段有: 分泌 響應 REMOTEIP(此一個是可選的) 請看看我發給你的文檔。 – Brduca