and inside my action method i am checking if the user select the recaptcha or not, as follow:-
public async Task<IActionResult> SearchNPI(ContactinfoCreate ci)
{
//add uncompleted entry
ViewData["ReCaptchaKey"] = _configuration.GetSection("GoogleReCaptcha:key").Value;
if (!ReCaptchaPassed(
Request.Form["g-recaptcha-response"], // that's how you get it from the Request object
_configuration.GetSection("GoogleReCaptcha:secret").Value,
_logger
))
{
ModelState.AddModelError(string.Empty, "Please enter CAPTCHA");
}
but on the client side how i can ake the recaptcha required filed, so the user can not submit the form unless he/she select the recaptcha?
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
488 Points
2558 Posts
make the recaptcha a required field
Jul 11, 2020 01:10 PM|johnjohn123123|LINK
I am working on an asp.net core mvc web application, and i have added the following field to show google recaptcha version 2:-
and inside my action method i am checking if the user select the recaptcha or not, as follow:-
but on the client side how i can ake the recaptcha required filed, so the user can not submit the form unless he/she select the recaptcha?
Contributor
2690 Points
874 Posts
Re: make the recaptcha a required field
Jul 13, 2020 08:59 AM|Rena Ni|LINK
Hi johnjohn123123,
For how to make the recaptcha a required field,you could refer to:
https://stackoverflow.com/a/37048027/11398810
https://stackoverflow.com/a/29613089/11398810
Best Regards,
Rena