Sunil Jagadish

CAPTCHA Generator for .NET

with 5 comments

I needed a CAPTCHA generator for some stuff I’ve been doing. I looked around and did find some assemblies for .NET. I thought of coding my own CAPTCHA generator and decided to do this using C#. The result – You can download/contribute here. You can even download a sample usage of this in a Windows Forms application form the “Releases” section. This can even be used in ASP.NET applications. This assembly will need permission to write to disk (to store the CAPTCHA image generated).


Usage

using CAPTCHA;
CaptchaGenerator cgen;

Single custom coloured CAPTCHA
cgen.CaptchaColor = Color.FromArgb(130, 120, 130);
CaptchaText = cgen.GenerateCaptcha(@”G:\test1.gif”);
pictureBox1.ImageLocation = @”G:\test1.gif”;

Captcha2

Default Random Coloured CAPTCHA
cgen.ResetCaptchaColor();
CaptchaText = cgen.GenerateCaptcha(@”G:\test1.gif”);
pictureBox1.ImageLocation =
@”G:\test1.gif”;
Captcha1



Written by Sunil

2007.07.25 at 07:26 PM

Posted in .NET

5 Responses

Subscribe to comments with RSS.

  1. 😉

    Sharath

    2007.07.28 at 11:53 AM

  2. 😀

    suniljagadish

    2007.07.28 at 08:42 PM

  3. Hi suniljagadish . i try to use your captcha but a it return a erro
    “Use of unassigned local variable ‘cgen'”
    i make this code:
    CaptchaGenerator cgen;
    cgen.ResetCaptchaColor();
    this.Response.Write(
    cgen.GenerateCaptcha(@”E:\CTL\Imagenes\test1.gif”));

    Thank Man

    Bernardo

    2007.09.11 at 11:02 PM

  4. Hi Bernardo, sorry it has been a while since I checked the commends. You should do a –
    cgen = new CaptchaGenerator(); before using cgen.

    Sunil Jagadish

    2007.12.15 at 12:49 AM

  5. test

    test

    2010.12.21 at 04:14 AM


Leave a reply to Bernardo Cancel reply