Google ReCaptcha Implementaion in ASP.Net


.aspx
<%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %>

<form id="form1" runat="server">
    <div>
        <recaptcha:RecaptchaControl ID="recaptcha" runat="server" PublicKey="6LfG4dcSA A A A A Lm Tx u3m X l s 18bOCLDX rBfhy -opZ"
            PrivateKey="6LfG4dcSA A A A A DW1NEM z A 1V 2cM Jx F2EwX M dz X Em I" />
        <asp:PlaceHolder ID="Pholder" runat="server"></asp:PlaceHolder>
    </div>
    <div>
        <asp:Button ID="btncheck" runat="server" Text="Submit" OnClick="btncheck_Click" />
        <br />
        <asp:Label ID="lblerr" runat="server" ForeColor="Red"></asp:Label>
    </div>
    </form>

.aspx.cs

//This is for dynamic Recaptcha Creation
        protected void Page_Init(object sender, EventArgs e)
        {
            Recaptcha.RecaptchaControl rec = new Recaptcha.RecaptchaControl();
            rec.ID = "recaptcha";
            rec.PublicKey = "6LfG4dcSA A A A A Lm Tx u3m X l s 18bOCLDX rBfhy -opZ";
            rec.PrivateKey = "6LfG4dcSA A A A A DW1NEM z A 1V 2cM Jx F2EwX M dz X Em I";
            Pholder.Controls.Add(rec);
        }


protected void btncheck_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)//You can use directly recaptcha.IsValid but it won't check for whole Page
            {
                lblerr.Text = "Valid Submission";
            }
            else
            {
                lblerr.Text = "In Valid Submission";
            }
        }

You Can Download the Working Code of Google ReCaptcha Implementaion in ASP.Net From here.

You Can Download the Working Code of Captcha in ASP.Net From here.