CAPTCHA for ASP

CAPTCHA stands for “Completely Automated Public Turing test to tell Computers and Humans Apart” which is more known to public as a verification code one needs to enter in order to proceed with certain action. The challenge is aimed to prevent from automated operation, such as, for instance, user registration, spam or data mining.

Alax.Info Captcha Module offers a COM object to generate CAPTCHA PNG (Portable Network Graphics) images:

08-image001.png

The images are generated using a few lines of code:

<%@Language=”JScript”%>
<%

CaptchaText = (1000 + Math.random() * 9000).toFixed(0);
CaptchaImage = Server.CreateObject(“Alax.Info.Captcha.Image”);
CaptchaImage.Text = CaptchaText;
CaptchaImageFileName = “image.png”; // TODO: Choose random name, esp. per-session
CaptchaFileStream = Server.CreateObject(“Alax.Info.Captcha.FileStream”);
CaptchaFileStream.Path = Server.MapPath(CaptchaImageFileName);
CaptchaImage.Create(CaptchaFileStream);

%>

< img xsrc=”<%=CaptchaImageFileName%>?rand<%=Math.random().toString()%>” />

Alax.Info.Captcha.Image COM object exposes the following properties and methods:

  • Properties
    • Width, Height – dimensions of generated image in pixels
    • BackColor, ForeColor – background and foreground (junk lines and font) colors
    • BorderColor, BorderWidth – image border properties
    • Text – text to embed into the image
  • Methods
    • Create – generate image into stream

The image may be generated into any compatible implementation of COM IStream interface, the module also provides Alax.Info.Captcha.FileStream COM object to provide IStream implementation to write image into local file.

Application Name: Alax.Info Captcha Module
License: Free for personal use, request commercial licenses via email or contact form
Latest Version: 1.0.0.111
Download Link: Alax.Info Captcha Module 1.0.0.111 (263K)

See Also:

Leave a Reply