پیاده سازی Google reCaptcha در ASP.NET Core
نویسنده: شریعتی پیام
تاریخ: ۱۴۰۰/۰۶/۰۶ ۱۸:۵۱
آدرس: www.dntips.ir
در این روش تنها کافی است که ویوو مدلی که میخواید باهاش عمل اعتبار سنجی google reCaptcha رو انجام بدید از ویوو مدل GoogleReCaptchaModelBase ارث بری کند و با بررسی ModelState صحت درستی Captcha هم بررسی میشود.
public class LoginViewModel : GoogleReCaptchaModelBase
{
// Fields
}
var httpResponse = httpClient.GetAsync($"https://www.google.com/recaptcha/api/siteverify?secret={reCaptchaSecret}&response={reCaptchResponse}").Result; var httpResponse = httpClient.GetAsync($"https://www.google.com/recaptcha/api/siteverify?secret={reCaptchaSecret}&response={reCaptchResponse}").GetAwaiter().GetResult();