0

我正在尝试在我的网页上使用 Google Recaptcha。我不断收到错误消息

GoogleReCaptcha.GoogleReCaptcha)(System.Web.HttpRuntime.WebObjectActivator.GetService(typeof(GoogleReCaptcha.GoogleReCaptcha))));

下面是屏幕截图:

在此处输入图像描述

下面是我的aspx页面代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TryAgain.WebForm1" %>
<%@ Register Assembly="GoogleReCaptcha" Namespace="GoogleReCaptcha" TagPrefix="cc1" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
             <p>
        <h1>Google ReCaptcha Form</h1>
        <asp:TextBox ID="txt" runat="server"></asp:TextBox>
        <cc1:GoogleReCaptcha ID="ctrlGoogleReCaptcha" runat="server" PublicKey="XXXX" PrivateKey="XXX" />
        <asp:Panel ID="Panel1" runat="server">
        </asp:Panel>
        <asp:Label ID="lblStatus" runat="server" Text=""></asp:Label>
        <asp:Button ID="btn" runat="server" Text="Submit" OnClick="btn_Click" />
    </p>
        </div>
    </form>
</body>
</html>

下面是我的 aspx.cs 文件代码:

   protected void btn_Click(object sender, EventArgs e)
        {
            if (ctrlGoogleReCaptcha.Validate())
            {
                //submit form
                lblStatus.Text = "Success";
            }
            else
            {
                lblStatus.Text = "Captcha Failed!! Please try again!!";
            }
        }

我下载的 GoogleRecaptcha 具有如下属性:

在此处输入图像描述

我为这个错误苦苦挣扎了好几个小时。任何帮助将不胜感激。

4

0 回答 0