This project is read-only.

Welcome to Recaptcha for .NET Documentation

Recaptcha for .NET allows you to easily integrate Google's Recaptcha service in an ASP.NET Web Forms or ASP.NET MVC web application with few lines of code.


The library provides the following functionality:
  • Render recaptcha control (HTML) with appropriate options for pre-defined themes and culture (language).
  • Verify user's answer to recaptcha's challenge.
  • Supports ASP.NET Web Forms and ASP.NET MVC.
Before you can use Recaptcha in your web application, you must first recaptcha key (a pair of public and private keys) and then download/install Recaptcha for .NET on your computer. Both steps are straight-forward: After you are done with creating your recaptcha key and installing Recaptcha for .NET on your computer, using recaptcha in your ASP.NET Web Forms application or ASP.NET MVC applications is a matter of few easy lines of code:

Last edited Jul 29, 2014 at 12:21 AM by tanveery, version 24


sujoya Nov 10, 2014 at 4:18 PM 
I am facing a problem The recaptcha is not able to validate properly. I have written the following codein the controller action method:
RecaptchaVerificationHelper recaptchaHelper = this.GetRecaptchaVerificationHelper();
if (String.IsNullOrEmpty(recaptchaHelper.Response))
ModelState.AddModelError("", "Captcha answer cannot be empty.");
return View(model);

RecaptchaVerificationResult recaptchaResult = await recaptchaHelper.VerifyRecaptchaResponseTaskAsync();

if (recaptchaResult != RecaptchaVerificationResult.Success)
ModelState.AddModelError("Captcha", "Incorrect captcha answer.");
return View(model);

When I check the value of recaptchaResult.ToString() , it is always returning "InvalidPrivateKey"

I have created entries for the private and public keys in web.config as follows:

<add key="recaptchaPublicKey" value="6Lf9av0S------4r" />
<add key="recaptchaPrivateKey" value="6Lf9av0SA ------Ai" />

In the view file (.cshtml) I have placed the captcha in the following way:

I am not able to specify the private key in the above extension method (as mentioned in this documentation) because I get the compile error "The best overload for 'Recaptcha' does not have a parameter named 'privateKey' "

I am using MVC 4 in Visual Studio 2012 environment and ASP.NET framework 4.0 and Recaptcha.Web.dll, v1.6.0.0

Sujoy (+91 8010189196)

k_f_maurice Sep 3, 2014 at 3:07 PM 
Thanks for this library. It makes working with reCAPTCHA very easy. Anyway, it also supports custom theming implicetely. You can make it work with Ajax reloading as well as push the reCAPTCHA validation into an action filter without loosing any functionality. I wrote a blog about it here:


fransjvanderlinde Nov 19, 2013 at 12:07 PM 
Is there any documentation on how to style the control in a responsive design template to work on a mobile phone.