Implement Google ReCaptcha V3 in ASP.Net

Last Reply 3 months ago By dharmendr

Posted 3 months ago

Hello I want to setup Google recaptcha V3 in my ASP.Net 3tier code.

i try so many thing but not work , i am try also using Jquery its work but not proper way can you help me to setup Google recaptcha V3 in my ASP.Net C# 3tier code 

Results 1 - 5 of 6 12

Posted 3 months ago

Sir its not working Bec I try to use in C#3tier  VS2010 


Posted 3 months ago

i try so many code but result is 0.

please if you have any better option for C#3tier 2010 please help me


Posted 3 months ago

Hi gkumar,

Share your implemented code and let me know which line you are getting issue.


Posted 3 months ago

Sir i try V2 but need V3 code.

my code is simple google recaptcha v2 java script code.

i need V3 code for both side authentication.

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" %>
<%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>

    <title>Google captcha</title>
<script src="https://www.google.com/recaptcha/api.js?render=_reCAPTCHA_site_key"></script>
<script>
    grecaptcha.ready(function () {
        grecaptcha.execute('6LeL3eUUAAAAAHYw5S2X73XAoOWCMFfdUyXyL5Ey', { action: 'homepage' }).then(function (token) {
            document.getElementById('returnToken').value = token;
            document.getElementById('abc').value = 456;
        });
    });
</script>

    <!-- start-smoth-scrolling -->
</head>
<body>
       <!-- //contact -->
    <!-- footer -->
    <div class="footer">
        <div class="container">
            <form id="frm1" runat="server">
            <div class="col-md-6 footer-left">
                <asp:TextBox ID="txtName" runat="server" placeholder="Name"></asp:TextBox>
                <asp:RequiredFieldValidator ID="reqName" runat="server" ControlToValidate="txtName"
                    ForeColor="Red" Text="Please Enter Name." ValidationGroup="contact"></asp:RequiredFieldValidator>
                <br />
                <br />
                <%--<input name="Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Name';}" required="" type="text" value="Name" />--%>
                <asp:TextBox ID="txtEmail" runat="server" placeholder="Email"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtEmail"
                    ForeColor="Red" Text="Please Enter Email." ValidationGroup="contact"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regexEmailValid" runat="server" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                    ForeColor="Red" ControlToValidate="txtEmail" ErrorMessage="Invalid Email Format"
                    ValidationGroup="contact"></asp:RegularExpressionValidator>
                <br />
                <br />
                <%--<input name="Email" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email';}" required="" type="email" value="Email" />--%>
                <asp:TextBox ID="txtMobileNumber" runat="server" placeholder="Mobile Number"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtMobileNumber"
                    ForeColor="Red" Text="Please Enter Mobile Number." ValidationGroup="contact"></asp:RequiredFieldValidator>
                <br />
                <%--<input name="Mobile Number" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Mobile Number';}" required="" type="text" value="Mobile Number" />--%>
            </div>
            <div class="col-md-6 footer-right">
                <asp:TextBox ID="txtMessage" runat="server" placeholder="Message" TextMode="MultiLine"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtMessage"
                    ForeColor="Red" Text="Please Enter Message." ValidationGroup="contact"></asp:RequiredFieldValidator>
                <%--<textarea name="Message..." onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Message...';}"required="" type="textarea" value="Message...">Message...</textarea>--%>
                <div class="clearfix">
                </div>
                   <div class="g-recaptcha" data-sitekey="my_site_key"></div>
                <asp:Label ID="lblmsg" runat="server" Text="Label"></asp:Label>
                <asp:Button ID="btnSendMail" Text="Send Message..!!" runat="server" ValidationGroup="contact"
                    OnClick="btnSendMail_Click" />
                <%--<input usemap="index.html" type="submit" value="Submit Now" />--%>
            </div>
            <div class="clearfix">
            </div>
            </form>
            <p class="copy-rights">&copy; <script>                                              document.write(new Date().getFullYear());</script> Cloudinfosoft &trade; All Rights Reserved | Design by <a href="http://cloudinfosoft.com/">
                    cloudinfosoft</a></p>
        </div>
	<%--<div class="divc"><a href="https://www.worldflagcounter.com/details/fhq"><img src="https://www.worldflagcounter.com/fhq/" alt="Flag Counter" style="margin-top: -55px;width: 400px;></a></div>--%>
    </div>
    <!-- //footer -->
</body>
</html>