<%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %>
<recaptcha:RecaptchaControl ID="myCheck" runat="server" PublicKey="your_public_key" PrivateKey="your_private_key" />
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="myWebForm.aspx.cs" Inherits="WebApplication.myWebForm" %> <%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <recaptcha:RecaptchaControl ID="rcCheck" runat="server" PublicKey="6LecdRYUAAAAAD3W0PGhRENtLV6qNHlvwCekxTZB" PrivateKey="6LecdRYUAAAAAB9onGAL2HDhVadT2T_CQKHlOOB-" /> <asp:Button ID="btnCheck" runat="server" Text="Check" OnClick="btnCheck_Click" /> <br /> <br /> <asp:Label ID="lblResult" runat="server" /> </form> </body> </html>
Protected Sub btnCheck_Click(sender As Object, e As EventArgs) If Me.rcCheck.IsValid Then Me.lblResult.Text = "<font color='green'>Congratulations</font>" Else Me.lblResult.Text = "<font color='red'>Captcha Invalid code</font>" End If End Sub
protected void btnCheck_Click(object sender, EventArgs e) { if(this.rcCheck.IsValid) { this.lblResult.Text = "<font color='green'>Congratulations</font>"; } else { this.lblResult.Text = "<font color='red'>Captcha Invalid code</font>"; } }