Captcha ASP script - prevents automated form sumbissions

Captcha ASP image test against automated form submission
Links
External Links
Other products
     The main idea of a Captcha test (completely automated public Turing test to tell computers and humans apart) is to prevent automated form submission.
     This project is a very short VB Script source code, which let's you generate gif, jpg or png images with text which most people can easily read and enter to a form field, but automated computer program cannot.

About 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 create some code with a public object, usually installed on hostings. One of them is a Chart object from Office web components.

     So I created a short include generating a "human testing" images and some form samples written in ASP. You can download them from motobit.com site. The code is free. Please include a next link on your pages if you use this include or samples:
This site is using
<a href="https://www.motobit.com/util/captcha/" 
  title="Captcha ASP image test against automated form 
  submission">Captcha for ASP</a>

Using this VBScript code and includes

     This project contains one ASP include, _captcha.asp and several samples. Please take a look at sample1 folder, form-session.asp sample.
     form-session.asp generates a random text (using RandomText function from _captcha.asp), which is stored to a session.
response.cookies("checktext") = RandomText(5)
and the source form in form-session.asp contains one more text field named imagecheck:
<input type="text" name="imagecheck" size="5" />
Generate-captcha.asp script creates a GIF image with the random text, using textToGIF function and BinaryWrite method.
<!--#INCLUDE FILE="_captcha.asp"-->
<%
  response.ContentType = "image/gif"
  response.binarywrite textToGIF(request.cookies("checktext"))
%>
form-session.asp accepts form dat then and checks validity of text written by client.
if len(request("imagecheck"))>0 and _
  ucase("" & request("imagecheck")) = ucase("" & request.cookies("checktext")) then 
    response.write "The form was accepted."
end if
     You can see more technical details on How it works page.

Install office web components

1. download Office web components from MS site.
2. Install the software on your server (run owc10.exe or owc11.exe on your server) or install it manually.
    - unpack the owc11.exe file using 'owc11.exe /C /T:c:\temp
    - unpack OWC11.DLL (OWC10.DLL) from the msi package
    - copy OWC11.DLL (OWC10.DLL) to your server and register the DLL by 'regsvr32 OWC11.DLL'

Remember that the Office web components are licensed. Next is a part of OWC license agreement:

1. GRANT OF LICENSE. If You licensed the Software from Your hardware manufacturer, You may install and use one (1) copy of the Software. If You have a valid end user license for Microsoft Office 2003 or any component application of the Microsoft Office System, Microsoft Office XP, Access 2002, Excel 2002, FrontPage 2002, or any other product identified by Microsoft and with which the Software interoperates (the "Licensed Products"), and You licensed the Software from Microsoft, You may use one (1) copy of the Software in accordance with the end user license agreement that accompanied the Licensed Product. If You are not a licensee of any of the Licensed Products, You may only install and use one (1) copy of the Software for the sole purpose of viewing and printing copies of static documents, text and images created with the Software; You cannot make any other use of the Software whatsoever.
© 2006 Antonin Foller, Motobit Software, help{at}pstruh.cz