Monday, September 28, 2009

Captcha ASP.NET 2.0 Server Control

Captcha control is used to validate user in terms of avoiding spamming on message or comments or registration or so on . implement Captcha on your application , below are the steps how u can do that

Installation instruction:

1. Unzip the downloaded file.
2. Copy MSCaptcha.dll and MSCaptcha.xml files to your /bin application directory.
3. add reference to mscaptcha.dll file.
4. Modify your web.config file, by adding this line to &l;httphandlers> section:
<add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>

5.Add MSCaptcha control to your Visual Studio toolbox (optional)

how to use on Page

1. Add line to your .aspx file:
<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" % >

2. add the control whenever you want:

<cc1:CaptchaControl ID="ccJoin" runat="server" CaptchaBackgroundNoise="none" CaptchaLength="5" CaptchaHeight="60" CaptchaWidth="200" CaptchaLineNoise="None" CaptchaMinTimeout="5" CaptchaMaxTimeout="240" / >

3. Add this on your CS file to check or Validate enter captcha is right or wrong

if (!ccJoin.UserValidated)
//Inform user that his input was wrong ...

now its look like this way :

Download Here..

Captcha ASP.NET 2.0

1 comment: