Last post May 30, 2017 07:18 AM by Eric Du
May 24, 2017 08:22 PM|rpfinnimore|LINK
I'm trying to add a captcha to the contact form on my webform. Installed the nugget package Captcha and BotDetect now shows up on my list of references as expected but when I put in the aspx code...
<asp:textbox ID="txtCaptcha" runat="server"></asp:textbox>
<botdetect:captcha ID="captchaBox" runat="server"></botdetect:captcha>
...visual studio underlines botdetect and indicates "unrecognized tagprefix or device filter 'botdetect' .
Would someone kindly tell me what I need to do to get the tagprefix recognized or what I'm doing wrong? Thanks tonnes for any help, Roscoe
May 24, 2017 11:41 PM|markfitzme|LINK
You haven't registered the control prefix. It knows about the class library, but nothing about the botdetect prefix.
I found examples in: https://captcha.com/doc/aspnet/examples/csharp/captcha-application-config-settings-example.html
There's also more configuration than just registering the prefix, you'll need to register the httphandler as well. The web.config section of the above example illustrates this.
May 25, 2017 07:48 AM|Eric Du|LINK
According to your description and error message, as far as I know, you need register it in the page before use it. Like it:
<%@ Register TagPrefix="botdetect" Namespace="captcha" Assembly= "" %>
For more details about register customer control in web page, please refer to this tutorial:
HOW TO: Register an Assembly in a WebForm to Use a Custom Control:
May 25, 2017 02:17 PM|rpfinnimore|LINK
Hi markfitzme thanks for the quick reply but the link to examples does not seem to work
May 30, 2017 07:18 AM|Eric Du|LINK
According to your description, I make a test in my side, I found it works in myside, please check the following steps:
1. install package BotDetect through manage packages for solution.
2. it will create the below code automatically, please check the following code in web.config:
<section name="botDetect" requirePermission="false" type="BotDetect.Configuration.BotDetectConfigurationSection, BotDetect" />
<add verb="GET" path="BotDetectCaptcha.ashx" type="BotDetect.Web.CaptchaHandler, BotDetect" />
<add assembly="BotDetect" namespace="BotDetect.Web.UI" tagPrefix="BotDetect" />
<remove name="BotDetectCaptchaHandler" />
<add name="BotDetectCaptchaHandler" preCondition="integratedMode" verb="GET" path="BotDetectCaptcha.ashx" type="BotDetect.Web.CaptchaHandler, BotDetect" />
<botDetect helpLinkEnabled="true" helpLinkMode="image" />
3. add the following code directly in the page:
<label for="CaptchaCodeTextBox">Retype the characters from the picture:</label>
<BotDetect:WebFormsCaptcha runat="server" ID="ExampleCaptcha"