Friday, January 20, 2012

C#(CAPTCHA for dotnet framework)

Installation instruction:

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

    If using IIS 7, add name parameter .
    If using Captcha version 4, use "MSCaptcha.captchaImageHandler" instead.
  5. Add MSCaptcha control to your Visual Studio toolbox (optional)
  6. That's it!
Example of use:

  1. Add line to your .aspx file:
    <%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>
  2. Where needed, add the control itself:
    <cc1:CaptchaControl ID="ccJoin" runat="server" CaptchaBackgroundNoise="none" CaptchaLength="5"CaptchaHeight="60" CaptchaWidth="200" CaptchaLineNoise="None" CaptchaMinTimeout="5"CaptchaMaxTimeout="240" />
  3. Put a textbox somewhere in your page where your user must enter what he sees in your captcha. Put this code (this example is in C#) to validate user input:

    ccJoin.ValidateCaptcha(txtCap.Text);
    if (!ccJoin.UserValidated)
    {
      //Inform user that his input was wrong ...
      return;
    }

    In this particular example the ccJoin is the name of the Captcha control, the txtCap is the textbox where user entered what he sees in Captcha.


Captcha 2.0+ Download: Here... 
Captcha 4.0 Download: Here...

No comments:

Post a Comment