There are some cases when a user want to validate a CAPTCHA and perform some activity on its results. ReCAPTCHA gives an .NET API to perform some operations on its CAPTCHA component. Following is the code to validate a CAPTCHA on server side.

ASPX Markup:

<!– Start ReCAPTCHA –>
<span class="orangetext">Captcha Verification:</span>
PublicKey = Public Key
PrivateKey=Private Key
Theme="blackglass" />
<!– End ReCAPTCHA –>


String challenge = Request["recaptcha_challenge_field"];
String reponseField = Request["recaptcha_response_field"];
String privateKey = "6LeptwEAAAAAAAQkSaGs-eb5ak6UaJrFUBLcRlKO";

Recaptcha.RecaptchaValidator abc = new Recaptcha.RecaptchaValidator();
abc.Challenge = challenge;
abc.PrivateKey = privateKey;
abc.RemoteIP = Request.ServerVariables["REMOTE_ADDR"];
abc.Response = reponseField;

Recaptcha.RecaptchaResponse resp = abc.Validate();

if (!resp.IsValid)
Response.Write("<pPlease input correct verification code!</p>");