Anjali
Anjali

Reputation: 2698

Google Recaptcha in ASP.net 4.7.2

I am trying to install Recaptcha in my project. In order to accomplish that, I downloaded

 recaptcha-dotnet-1.0.5.0-binary.zip 

from here

https://code.google.com/archive/p/recaptcha/downloads

I unzipped the zip file and placed the Recpatcha in my project references:

I added Recaptcha in my asp.net page like so:

enter image description here

I put the below tag in my asp.net web form

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

then I added the code in my aspx page like so:

<form id="form1" runat="server">
        <div>

          <recaptcha:RecaptchaControl
              ID="recaptcha"
              runat="server"
              Theme="red"
              PublicKey="xxxx"
              PrivateKey="xxxxx"
              />

          <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" style="height: 26px" />
        </div>
    </form>

when I run the asp.net application by pressing F5. I don't see anything on my web page except the submit button:

enter image description here

I am not sure what am I doing wrong and how can I see Recaptcha.

I also followed this article :

https://www.codeproject.com/Tips/884193/Google-ReCaptcha-ASP-net-Control

and put the same GoogleREcaptcha that is mentioned in the article. I am getting the following error if I use the same dll as mentioned in the article

enter image description here

Any help will be highly appreciated.

Upvotes: 0

Views: 1261

Answers (1)

IrishChieftain
IrishChieftain

Reputation: 15253

Where is your code-behind? In any case, there are three versions of the Google ReCaptcha. Version 1.0 which you are using from an old archive is deprecated. At a minimum you should be using version 2.0

Here is an article which I often refer to when adding ReCaptcha 2.0 to Web Forms projects. If you follow these steps it should work for you:

Google ReCaptcha 2.0 - ASP.NET Control

Bear in mind the the keys you register for your live site will not work on your local machine. You can obtain free dev keys for developing locally.

Upvotes: 2

Related Questions