reCaptcha in asp.net c#

reCAPTCHA with ASP.NET


You must supply your own public/private recaptcha keys in the appSettings section
(you can create these at https://www.google.com/recaptcha/admin/create )

Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title> reCaptcha in asp.net c# </title>
    <!-- recaptcha client library -->
    <script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <% 
            // don't show another captcha after success
            if (!Page.IsPostBack || (Page.IsPostBack && !Page.IsValid))
            {
                // client-side captcha creation  (note the server-side injection of the public key and the page culture)
        %>
        <div id="recaptcha_div">
        </div>
        <script type='text/javascript'>
            Recaptcha.create("<%=Config.PublicKey %>",
                "recaptcha_div", {
                    lang: "<%=LanguageCode %>",
                    theme: "red", // red,white,blackglass,clean
                    callback: Recaptcha.focus_response_field
                });
        </script>
        <asp:Button runat="server" ID="submitBtn" Text="Submit" OnClick="OnSubmit" />
        <% } %>
        <asp:CustomValidator runat="server" ID="recaptchaValidator" OnServerValidate="OnRecaptchaValidate"
            Text="Incorrect" />
        <asp:Label runat="server" ID="Outcome" />
    </div>
    </form>
</body>
</html>

web.config
<appsettings>
 <add key="recaptcha_private" value="">
 <add key="recaptcha_public" value="">
</add></add></appsettings>


captcha with asp.net , captcha control in asp.net c#


Download Code

reCaptcha in asp.net c# reCaptcha in asp.net c# Reviewed by Unknown on 9:44 AM Rating: 5