DEV Community

Huseyin Simsek
Huseyin Simsek

Posted on • Updated on

Usage of ReCAPTCHA v3 in Asp.Net Core MVC Project

Hi All,
This is my first English post. So there can be some grammar mistakes in post, sorry about that in advance.

In this post, I will explain what is the difference between ReCAPTCHA v2 and v3 and how to use ReCAPTCHA v3 in Asp.Net Core MVC project.

ReCAPTCHA v2 requires a user interaction from user, such as clicking the ReCAPTCHA button to proof that you are a human. But ReCAPTHCA v3 will never interrupt your users. Google Api generates a score from 0 to 1 in v3. It means that generated score near to 0 (e.g. 0.1 or 0.3) is a bot, however generated score near to 1 is a human. Thus, according to the score, you can make a desicion that your form will be submitted or not.

You can integrate ReCAPTCHA v3 easily in your project. You need two keys(secretkey and sitekey from Google). You can give these keys with your google account. You can find information how to integrate in your code. And than save to your domains where you want to use ReCAPTCHA v3.

Alt Text

I'm created a simple example project using ReCAPTCHA v3 in Asp.Net Core MVC.

I hope that this help you. For more information, you can look Google Document

Top comments (2)

Collapse
 
berkslv profile image
berkslv

Hello, I'm writing from turkey like you, anyway, I'm getting "Unable to resolve service for type 'System.Net.Http.IHttpClientFactory' while attempting to activate" error. After integrating site key, models, controller, I got this error :( Please help

Collapse
 
huseyinsimsek profile image
Huseyin Simsek

Hi. What is your dotnet core version in project? And Did you add (register) HttpClient as middleware service in Startup.cs? I think this error occur HttpClient service difference between your code and dotnet version.