reCaptcha + Asp.Net MVC 3/4

What is reCaptcha ?

reCaptcha, it’s an anti-bot service, in other words checks if it was a human or a bot submitting a form. But it also has another utility, when we are using this service we are helping on digitize of books.

Here is an explanation of how it works. (Link)

If you want to learn more about this you should spend 15 mins of your day, watching this Ted Talk.

How to integrate reCaptcha with your Asp.NET MVC 3/4 application?

So, the first step is to create a private and public key for the access to our recaptcha.

Create Key – Link

Then, we need to install the “reCAPTCHA plugin for .NET” in our project through the Manage NuGet and add our keys to Web.Config file, following this instructions:

Now we need to create our html View, which will have the form.
To start, you have to add “@using Recaptcha;” to our View, to access to reCaptcha assembly.
reCaptcha plugin has one HtmlHelper which can generate Html for reCaptcha with our keys in Web.config.

Html.GenerateCaptcha(“captcha”, “red”), the second argument “red” it means the style of our Captcha..
Existing Styles: Link

The Controller for our Form:
We need to put again the reference for the assembly (using Recaptcha;)

Sample Images:

Step 1

Step 1

You can download a complete sample with all code: (Here)

I hope I helped you and “Good reCaptchas”. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Connect with Facebook