The first step
is to add the proper register declaration to your user control.
This statement is what allows you to later declare and use the Captcha control in your page. You can simply copy and paste this code to the top portion of your .ascx file.
<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls"%>
Declare the Control
The next step
is to actually place an instance of the control in your module.
Below is an example of a default configuration of the control, many other options exist for you to style the module to meet your needs, you can also implement a ResourceKey to allow localization of the error message.
<dnn:CaptchaControl ID="ctlCaptcha" CaptchaHeight="40" CaptchaWidth="150" </p>
ErrorStyle-CssClass="NormalRed" cssclass="Normal" runat="server"
ErrorMessage="The typed code must match the image, please try again"/>
As you can see this is a pretty simple step to complete, I have set the height and width of the captcha image to ensure that it fits nicely inside my area on the control, I also was sure to set the ErrorStyle and CssClass attributes to ensure that everything displays nicely with my skin. You have other options that you can configure here as well, including the number of characters and other items of that nature.
Validation of Captcha
The final step is to implement code
in the backend that validates the Captcha to ensure that the user supplied information was correct. Unlike other validation controls the Captcha does NOT validate prior to postback so this step is mandatory to ensure that the users supplied the Captcha. Below is some sample C# code to validate the Captcha, just a simple if statement.
//Do your processing!
Hope this will help you.