How to generate Google reCaptcha in Asp.Net



Here I have Example of reCaptcha in My Webpage and Image Handle for Generating reCaptcha in my Application. reCaptcha plugin is also useful for your login, Password recovery, comments, registration etc.

Google Captcha (reCAPTCHA) plugin allows you to implement a super security Captcha into web forms. Google Captcha (reCAPTCHA) is a free CAPTCHA service that helps to digitize books, newspapers older radio shows. This plugin can be used for login, registration, password recovery, comments forms. The new reCAPTCHA is here. A significant number of your users can now attest they are human without having to solve a CAPTCHA. Instead with just a single click they’ll confirm they are not a robot. We’re calling it the No CAPTCHA reCAPTCHA experience.

reCAPTCHA is a free service that protects your site from spam and abuse. It uses advanced risk analysis techniques to tell humans and bots apart. With the new API, a significant number of your valid human users will pass the reCAPTCHA challenge without having to solve a CAPTCHA. ReCAPTCHA comes in the form of a widget that you can easily add to your blog, forum, registration form, etc.

Replace your old reCaptcha with latest and brand new Google No Captcha reCaptcha Joomla registration, contact, reset password, and remind username forms on enabling this plugin.

Html Code:

<div>
        User Name :
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
       
        <recaptcha:RecaptchaControl ID="recaptcha" runat="server" PublicKey="6LeV7fwSAAAAACGlvCvX_cJzhsys5Ju_rW7Oqsn-"
            PrivateKey="6LeV7fwSAAAAACgQzjfZscePs-7d6kGx9A-RweGY" />
            <asp:Button ID="btnLogin" runat="server" Text="Submit" OnClick="btnLogin_Click" />
        <br />
        <asp:Label ID="lblResult" runat="server" Text=""></asp:Label>
    </div>

Code Behind

protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (recaptcha.IsValid)
            {
                TextBox1.ForeColor = System.Drawing.Color.Blue;
                lblResult.Text = TextBox1.Text + " Your Login Sucesfully at  " + DateTime.Now.ToString("dd-MM-yyyy");
                recaptcha.Visible = false;
                //lblResult.ForeColor = Color.Green;
            }
            else
            {
                lblResult.Text = "The User Name Is incorrect.";
                lblResult.ForeColor = Color.Red;
                recaptcha.Visible = true;
            }

Web.config File

<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;"/>
</appSettings>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <remove name="ChartImageHandler"/>
      <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </handlers>
</system.webServer>

Run you Webpage you will get reCaptcha Handler for your Application.

Related Posts

Previous
Next Post »

Thanks for comments.....