ASP.NET - MSCaptcha error in web.config - Asked By Salin Mathew on 11-Aug-11 09:23 AM

Hi,

I used the MSCaptcha control in my web application and went according the instructions. I added the Ajax reference, Captcha reference and a script manager into the application. But I get an error in the web.config file. The error occurs at the position where this code is written.

<add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>

If it runs in the local host, all works fine. But when I uploaded it into the server, I get configuration error at this point. Please help me solve it.

Thanks,
Sal
Jitendra Faye replied to Salin Mathew on 11-Aug-11 09:37 AM
follow these steps to use MSCaptcha

1. The MSCaptcha.dll and MSCaptcha.xml files are in the bin folder.

2. The web.config file has been modifed:
    <httpHandlers>
      <add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>
    </httpHandlers>

3. This line has been added to the ASP page:
<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="mscaptcha" %>

4. And the control is displayed:
                    <mscaptcha:CaptchaControl ID="MSCaptcha" runat="server"
                        CaptchaBackgroundNoise="low" CaptchaLength="5" CaptchaHeight="40" CaptchaWidth="100" CaptchaLineNoise="None" CaptchaMinTimeout="5" CaptchaMaxTimeout="240" />

Hope this will help you.
Salin Mathew replied to Jitendra Faye on 11-Aug-11 10:10 AM
Thanks Vickey,

But now there is a new problem. The error shows in this line:

<mscaptcha:CaptchaControl ID="MSCaptcha" runat="server" CaptchaBackgroundNoise="low" CaptchaLength="5" CaptchaHeight="40" CaptchaWidth="100" CaptchaLineNoise="None" CaptchaMinTimeout="5" CaptchaMaxTimeout="240" />
The error message is :Compiler Error Message: CS0117: 'MSCaptcha.CaptchaControl' does not contain a definition for 'CaptchaImage'.

Do I have to use an attribute called CaptchaImage or something?

Thanks,
Sal
Radhika roy replied to Salin Mathew on 11-Aug-11 11:16 AM

 

Follow the instructions from http://www.aspsnippets.com/Articles/How-to-implement-Captcha-in-ASP.Net.aspxF


Add the following in web.config

1. <handlers>
    <add name ="MSCaptcha" verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>
  </handlers>

2. <location path="CaptchaImage.axd">
    <system.web>
    <authorization>
      <allow users="*"/>
    </authorization>
    </system.web>
  </location> 

Hope this will help you.

 

dipa ahuja replied to Salin Mathew on 11-Aug-11 12:02 PM
Untitled document
For captcha control you can use this :

<http://code.google.com/apis/recaptcha/docs/aspnet.html>

OR

<http://www.mondor.org/captcha.aspx>

To Use this controls just add them in the toolBox By:
 
Right click on tool Box - >Add tab Now give name to this tab
 
next Add a control by ->Right click on that tab - > Choose items...
 
Now locate the captcha dll file and click add to add it to the tab
 
To USe it
 
1.    Add line to your .aspx file:
<%
@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>
2.    Where needed, add the control itself:
<cc1:CaptchaControl ID="ccJoin" runat="server" CaptchaBackgroundNoise="none" CaptchaLength="5" CaptchaHeight="60"CaptchaWidth="200" CaptchaLineNoise="None" CaptchaMinTimeout="5" CaptchaMaxTimeout="240" />
3.    Put a textbox somewhere in your page where your user must enter what he sees in your captcha. Put this code (this example is in C#) to validate user input:

ccJoin.ValidateCaptcha(txtCap.Text);
if (!ccJoin.UserValidated)
{
 //Inform user that his input was wrong ...
 return;
}
Hope this will help you!
 
Katrijn Nielsen replied to Salin Mathew on 11-Jan-12 08:26 AM
There is a sample application available for MSCaptcha. It shows how to run it in both IIS and local environment.

http://www.kirsanov.net/post/2011/10/28/CAPTCHA-sample-project.aspx 
Priya Sharma Sharma replied to Katrijn Nielsen on 01-Nov-13 04:10 AM
MSCaptcha.CaptchaImageHandler issue solution...http://mytecharticle.com/?p=632