나는 ASP.NET 웹 API 2 프로젝트를 가지고 있습니다. 양식에서 Google Captcha를 읽으려고합니다.웹 API 2의 Google reCaptcha C#
public string Post(FoundingRequest model)
{
var response = Request["g-recaptcha-response"];
string secretKey = "my key";
var client = new WebClient();
var result = client.DownloadString(
$"https://www.google.com/recaptcha/api/siteverify?secret={secretKey}&response={response}");
var obj = JObject.Parse(result);
model.Captcha = (bool)obj.SelectToken("success");
....
}
하지만 첫 번째 줄에 오류를 받고 있어요 : 나는이 코드를 시도
의 표현에 []와 색인을 적용 할 수 없습니다유형 'HttpRequestMessage'
왜? 어떻게 해결할 수 있을까요?
문제는 다음 행에 있습니다. var response = Request [ "g-recaptcha-response"]; –
업데이트를 확인하십시오. 그것은 JS 및 웹 API – SouXin