Tuesday, 15 January 2013 13:56

how to add captcha in asp.net page

Written by 
Rate this item
(0 votes)

A CAPTCHA is a program which tells whether its user
is human or computers.

follow the steps below to add captcha in your web form
easily -

1.download the library from here -

2.then add a reference of the downloaded Recaptcha.dll
file to your website

3.then insert the recaptcha control to your aspx page
by adding at top-
<%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %>

then under form tag -
<recaptcha:RecaptchaControl ID="recaptcha" runat="server"
PublicKey="" PrivateKey=""/>

4.then sign up for API key here -
after that place the public key and private key
in the PublicKey and PrivateKey properties in the above code

5.add the follwing lines too under your form tag in your page -

<form runat="server">
<asp:Label Visible=false ID="lblResult" runat="server" />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />

6.add the following button click method in code behind file
of your page -
protected void btnSubmit_Click(object sender, EventArgs e)
if (Page.IsValid)
lblResult.Text = "You Got It!";
lblResult.Text = "Incorrect";

now test your page recaptcha.also read the following post
to overcome updatepanel problem -

Read 4010 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.