Briz ASP Captcha User's Manual

About Briz ASP Captcha

Briz ASP Captcha is a powerful easy-to-use ActiveX component to generate strong captcha images in your ASP applications. It allows you to stop undesirable automated submissions of ASP forms.

To go to the Briz ASP Captcha home page, please click here.

How to install the trial version

Follow the steps below to install the trial version of component on your server:

  1. unzip aspcaptcha_trial.zip to any folder on the server;
  2. register component there using the regsvr32 command-line system utility as follows:

    regsvr32 aspcaptcha32_trial.dll
    (on 32-bit versions of Windows)

    regsvr32 aspcaptcha64_trial.dll
    (on 64-bit versions of Windows)

    On Windows Vista or Windows 7, you should run Command Prompt utility "as Administrator" (from popup menu), and then run regsvr32 command. Otherwise regsvr32 can be unable to modify system registry to register the component.

Note: the trial version places a trial message on created captcha images.

Purchase

The trial version is intended for evaluation purposes only.
You can order the full version of Briz ASP Captcha on our site.

How to install the full version

Follow the steps below to install the full version of component on your server:

  1. unzip aspcaptcha.zip to any folder on the server;
  2. register component there using the regsvr32 command-line system utility as follows:

    regsvr32 aspcaptcha32.dll
    (on 32-bit versions of Windows)

    regsvr32 aspcaptcha64.dll
    (on 64-bit versions of Windows)

    On Windows Vista or Windows 7, you should run Command Prompt utility "as Administrator" (from popup menu), and then run regsvr32 command.

  3. restart IIS service;
  4. remove trial version (aspcaptcha32_trial.dll or aspcaptcha64_trial.dll) from the server.

How to use

Generate the random captcha text, save it into the session variable, create the captcha image and send it to client browser:

<%
set cp = server.createObject("briz.ASPCaptcha")
cp.SetRandomText 6, 8
Session("captcha_code") = cp.Text
cp.Send
%>

Retrieve the user input text and compare it with the captcha value that stored into the session variable:

<%
if Session("captcha_code") <> "" and _
  UCASE(Session("captcha_code")) = UCASE(Trim(Request("captcha_in"))) then
    Response.Write("Yes")
else
  Response.Write("No, code does not match")
end if

Session.Abandon
%>

The sample of HTML form that use the captcha checking (the captcha_img.asp file should contain the first sample above, the captcha_check.asp file should contain the second sample):

<html>
<head>

<script type="text/javascript">

function ReloadCaptcha() {
  var img = document.getElementById("captcha_img");
  img.src = "captcha_img.asp?rand=" + Math.random();
}

</script>

</head>

<body>
<h2>Captcha Test</h2>

<form action="captcha_check.asp" >
Field 1: <input>
<p>
Field 2: <input>
<p>
<img src="captcha_img.asp" id="captcha_img" width="200" height="70">
<img src="reload.png" width="64" height="64" vspace="3" 
      onClick="ReloadCaptcha()" title="Get a new challenge">
<br>
Type captcha value: <input name="captcha_in" len="10">
<br>(It is NOT case sensitive)
<p>
<input type="submit" value="Send Form">

</form>
</body>
</html>

Object Reference


Properties

Property Text As String (read/write)

Represents the captcha text.

Property EncryptedText As String (read/write)

Represents the captcha text encrypted by a password that specified by the SetPassword method.

Property EncryptionAge As Long (read)

Represents the time in seconds that elapsed from encryption moment.

Methods

Sub SetRandomText(MinLength As Long, MaxLength As Long)

Sets a random captcha text. The length of text is random value between MinLength and MaxLength.

Sub SetPassword(Password As String)

Set a password for EncryptedText property.

Sub Send()

Creates the captcha image, encodes to the specified output format and sends the result directly to the client browser by internally calling the Response.BinaryWrite method. Automatically sets the Content-Type header.

Sub SaveToFile(FileName As String)

Creates the captcha image, encodes to the specified output format and saves the result to the specified file.

Sub SaveToVar(Destination As Variant)

Creates the captcha image, encodes to the specified output format and saves the result to the specified variable.

Sub SetOutputFormat(FormatID As Long, JPEGQuality As Long)

Sets the output format for Send, SaveToFile and SaveToVar methods.
The FormatID parameter specifies the image format. Valid values are 1 - GIF, 2 - JPEG.
The JPEGQuality parameter specifies the JPEG encoding quality. Valid values are 1-100. Ignore for the GIF format.

Sub SetSize(Width As Long, Height As Long)

Sets the width and height of the captcha image.

Sub SetLines(Amount As Long, Thickness As Long)

Sets the amount of lines on the captcha image.

Sub SetColor(Font As OleColor, Background As OleColor)

Sets the colors of the captcha image. For example:
captcha.SetColor vbBlack, vbWhite
captcha.SetColor &h303030&, &hf0f0f0&


Copyright © 2012 BRIZ Software