A CAPTCHA is test that distinguishes a human from a computer. The Captcha web
control does this by displaying random text within an image. The text itself, as
well as the image's background, are distorted to make recognition of the text within
the image difficult for computer programs, but not so much that a human can not
easily identify the text. The Captcha web control is implemented as a validator
which must be successfully validated in order for page processing to continue.
Usage
To use the Captcha web control first place it on the ASP.NET page you wish to protect.
The most likely pages will be your blogs' comment and contact pages. The locations
of these files depend on the blog theme you're using. The typical location for them
would be:
Themes\Blogs\<theme>\post.aspx
Themes\Blogs\<theme>\contact.aspx
where <theme> is the theme name you're currently using.
The following line actually enables the Captcha, you can put it wherever you
would like the Captcha to appear:
<th:Captcha runat="server" id="captcha1" />
Next, move the "captchaimage.aspx" file within the archive to Community Server's
root directory. This is the actual image that the Captcha web control displays.
(By default authenticated users are not presented with a CAPTCHA test so you
won't see any difference on the page containing the Captcha if you are logged
in. You can either set the TestAuthenticatedUsers property to true or
logoff to see the CAPTCHA.)
Remarks
The Captcha is a templated control, which allows you to change the appearance of
its rendering. By using the <InnerTemplate> element within
the Captcha you can modify its appearance. When utilizing a template you must use a
System.Web.UI.WebControls.Image with an ID of "imgCaptcha" and a
System.Web.UI.WebControls.TextBox with and ID of "txtCode". The following example
illustrates a sample template containing all controls the Captcha uses.
<th:captcha runat="server" id="captcha1">
<innertemplate>
<!-- Required -->
<asp:image runat="server" id="imgCaptcha" />
<asp:textbox runat="server" id="txtCode" />
<!-- Optional -->
<asp:hyperlink runat="server" id="linkReload" />
<asp:label runat="server" id="lblError">The text entered was incorrect.</asp:label>
</innertemplate>
</th:captcha>
Example

An example of the image displayed from the Captcha web control.
Notes
Reference
Captcha Web Control
| Property |
Description |
CaptchaType (CaptchaType) |
Type of characters that should appear in the code. |
DisplayErrorMessage (bool) |
An indication of whether an error message should be displayed. |
ErrorMessage (string) |
Error message to display when the wrong code is entered. |
ErrorMessageColor (System.Drawing.Color) |
Font color of the error message. |
ErrorMessageTimeout (string) |
The error message to display when the time limit to enter the code has been exceeded. |
ImageBackColor (System.Drawing.Color) |
Color of the image background. |
ImageBackNoiseColor (System.Drawing.Color) |
Color of the image background noise. |
ImageFontName (string) |
Name of the font used in the image. |
ImageForeColor (System.Drawing.Color) |
Color of the image foreground. |
ImageForeNoiseColor (System.Drawing.Color) |
Color of the image foreground noise. |
ImageHeight (int) |
Height of the image. |
ImageSrc (string) |
Url of the image. |
ImageWidth (int) |
Width of the image. |
InnerTemplate (System.Web.UI.ITemplate) |
The template of the web control. |
Message (string) |
Instructional text displayed to user. |
NumberOfCharacters (int) |
Number of characters in the code. |
ReloadImageUrl (string) |
The URL of the CAPTCHA reload icon. Set to the empty string to display no icon. |
ReloadText (string) |
The text of the CAPTCHA reload icon. If the ReloadImageUrl property is set to a value this proprety becomes the icon's tooltip, otherwise it is displayed as text. |
TestAuthenticatedUsers (bool) |
Indicates if the control should be visible to authenticated users. |
| Value |
Description |
| Alphabetic |
Uses only lowercase alphabetic characters. |
| Alphanumeric |
Uses a combination of numbers and lowercase letters, the digit 0 and letter o are
never used with this value.
|
| Numeric |
Only numbers are used. |