ASP.net 4.7.2中的Google Recaptcha

问题描述 投票:0回答:1

我正在尝试在我的项目中安装Recaptcha。为此,我下载了

 recaptcha-dotnet-1.0.5.0-binary.zip 

从这里

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

我解压缩了zip文件并将Recpatcha放入我的项目引用中:

我像这样在我的asp.net页面中添加了Recaptcha:

enter image description here

我将以下标记放在asp.net网络表单中

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

然后我将代码添加到我的aspx页面中,如下所示:

<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>

当我按F5键运行asp.net应用程序时。除了“提交”按钮,我在网页上什么都没有看到:

enter image description here

我不确定我在做什么错,如何查看Recaptcha。

我也关注这篇文章:

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

并放置与文章中提到的相同的GoogleREcaptcha。如果使用与文章中提到的相同的dll,则会出现以下错误

enter image description here

任何帮助将不胜感激。

asp.net recaptcha
1个回答
0
投票

您的代码在后面?无论如何,有三种版本的Google ReCaptcha。您从旧档案中使用的1.0版是不推荐使用。至少您应该使用version 2.0

这里是将ReCaptcha 2.0添加到Web Forms项目时经常引用的文章。如果您按照以下步骤操作,它将为您工作:

Google ReCaptcha 2.0 - ASP.NET Control

请记住,您为实时站点注册的密钥在本地计算机上不起作用。您可以获取免费的开发密钥,以进行本地开发。

© www.soinside.com 2019 - 2024. All rights reserved.