Captcha ASP script - prevents automated form sumbissions

Captcha ASP image test against automated form submission
Links
External Links
Other products

Progress of this project

     Some weeks ago I had really need this simple test for ASP (and ASP.Net also), but I found only some very long codes with css or some script generating bmp images. I have decided to use some simple code with public object, Chart from Office web components. The component works on most Windows 2000 or 2003 hostings (please see licensing note on the download page if you have your own hosting)

How it works inside

Some of such object is a Chart object from Office web components. You can generate a gif picture in a short code using the component:
  Dim Chs
  Set Chs = CreateObject("OWC10.ChartSpace") 

  Chs.ExportPicture "c:\temp\image.gif", , 120, 55
     And there is a quick way to captcha image - simple add a chart, create a title (HasTitle = True), write some text to the title (Caption = inText), set font family and size and the image finished.
  'Get chart constants
  Dim chConstants: Set chConstants = Chs.Constants
  
  'Get a chart object 
  Dim Chart: Set Chart = Chs.Charts.Add

  'Enable title for the chart.
  Chart.HasTitle = True

  'Set the text and properties.  
  Chart.Title.Caption = inText
  Chart.Title.Font.Name = "Algerian" '"Algerian"
  Chart.Title.Font.Size = 20
     The last thing to do is to set some background patterns, font styles, sizes and colors to make harder to read the text by automated program. You can use several methods of Interior object, the best of them for this usage is a SetPresetGradient method. There are several preset patterns and colors gallery in the office web components library. You can see some of them bellow:

Human image test Human image test Human image test Human image test

     The chart is created. Now you can export the "chart" (empty chart with title only) by ExportPicture method of the chartspace object. Then I used ReadBinaryFile VBS function to retrieve the stored image from a disk and BinaryWrite method to show the image on client.

Performance of the script

     There is no problem with performance of the image generating script. I tested office web components with very high load also, and my code using OWC can handle up to 200 requests/second on AMD 3000+. (I mean you never reach the limit :-)

What other you can do with OWC?

     OWC is a powerful component for charts and server work. One of very simple task is Gradient generator.
© 2006 Antonin Foller, Motobit Software, help{at}pstruh.cz