Image-Based Bot Detector is a variant of image-based CAPTCHAs that uses human ability to recognize a distorted region on the image he never seen before.
In order to use it you have to set
TemplateImageFolder property to relative virtual path of the template images folder - for example, "~/templates" and to add registration of
HttpHandler in web.config.
<add verb="GET" path="ImageBasedBotDetector.ashx"
There are 3 types of predefined distortion (
Volute) and user-defined (
Custom) distortion. In order to use predefined distortion it needs to set
DistortionType property. User-defined distortion can be used in derived classes with overriden
If you want to use template images that are placed elsewhere then a subfolder of your web application - for example, from database - you have to override
To check whether user passed the test
IsValid property is used. Also user can be locked after a predefined number of unsuccessful attempts to pass the test (
FailedAttemptsBeforeLocking property, default value is 5).
Requires .NET Framework 2.0
Working example of Image-Based Bot Detector.
Working example of the control derived from Image-Based Bot Detector.
|Gets or sets template image folder.|
|Gets or sets the number of unsuccessful attempts before locking.|
|Gets result of test passing.|
|Gets or sets value indicating where user is locked.|
|Gets or sets distortion type. Available types:
- Stretched - image within distorted area is stretched.
- Random - points within distorted area is mixed in a random way.
- Volute - image within distorted area is volute.
- Custom - custom distortion. Have to be used together with overriden DrawCustom method.
|Occurs when detector has been locked because of exceeding the failed attempts limit.|
public event EventHandler Locked
|Protected virtual methods|
|Gets template image.|
protected virtual System.Drawing.Image GetTemplateImage()
See example of usage.
|Distorts specified rectangle of image in a user defined way. Have to be used coupled with DistortionType=Custom|
protected virtual void DrawCustom(System.Drawing.Bitmap bitmap, System.Drawing.Image img, Rectangle distortedRectangle)
bitmap - the output image,
img - the template (input) image,
distortedRectangle - area on the image to be distorted.