Captcha

0 comments

I ran into a few problems with 'recaptcha' - i like it, but dont like how you need a site key for each one. Instead i decided to use MSCaptcha. Here is what I did:

 

add this to web.config:

 

     <system.web>
        <httpHandlers>
            <add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>
        </httpHandlers>
    </system.web>
    <system.webServer>
        <handlers>
            <!--iis7 version-->
            <add name="MSCaptcha" verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/>
        </handlers>
    </system.webServer>

 

add this to aspx:

<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>

and...

 

<tr>
    <td class="label">Security Check</td>
    <td class="entry">
        <span style="font-size:11px;padding:2px 0;">This is required to check you are a real person, not an internet robot.</span><br />
        <div style="border:1px solid black">

                <%--Visible="false"--%>
            <cc1:CaptchaControl ID="ccJoin" runat="server"                             
                CaptchaBackgroundNoise="none" 
                CaptchaLength="3" 
                CaptchaHeight="60" 
                CaptchaWidth="300" 
                CaptchaLineNoise="low" 
                CaptchaMinTimeout="5" 
                CaptchaMaxTimeout="240"
                CaptchaChars="qwerty"/></div>
            What are the three letters written above?<br />
        <asp:TextBox runat="server" ID="txtCap" CssClass="required"></asp:TextBox>

    </td>
    <td class="required">*</td>
</tr>

add this to the save method:

 

PageErrorMessage="";
if(ccJoin.Visible)
{
    ccJoin.ValidateCaptcha(txtCap.Text);
    if (!ccJoin.UserValidated)
    {
        //Inform user that input was wrong ...
        PageErrorMessage="The captcha security code was wrong, please try again.";
    }
}else
{
    saveOK=Save();
}

 

and put the MSCaptcha.dll and MSCaptcha.xml files in the bin folder. Get it from http://www.mondor.org/captcha.aspx  download: http://www.mondor.org/files/mscaptcha.zip

 

nice one thanks lads from Mondor.

 

 

 

 

 


Comments


Leave a Comment