我在ASP.NET中使用reCAPTCHA。当我单独使用<recaptcha:RecaptchaControl>
时,它工作正常,当我将其添加到<asp:CreateUserWizard>
时<WizardSteps>
我得到System.NotImplementedException: This setter is not implemented.
这是我的代码:
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
OnCreatingUser="CreateUserWizard1_CreatingUser">
<WizardSteps>
<asp:WizardStep ID="CreateUserWizardStep0" runat="server">
<recaptcha:RecaptchaControl
ID="recaptcha"
runat="server"
Theme=""
PublicKey="my_public_key"
PrivateKey="my_private_key"
IsValid="False"
/>
</asp:WizardStep>
<asp:CreateUserWizardStep runat="server" Title="Yeni admin yarat" />
<asp:CompleteWizardStep runat="server" Title="Tamamla" />
</WizardSteps>
</asp:CreateUserWizard>
这是我的代码隐藏:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Registration : System.Web.UI.Page
{
protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
{
Recaptcha.RecaptchaControl captcha =
(Recaptcha.RecaptchaControl)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("recaptcha");
if (null == captcha)
{
e.Cancel = true;
return;
}
captcha.Validate();
if (!captcha.IsValid)
{
//TODO: Display validation message.
e.Cancel = true;
return;
}
e.Cancel = false;
}
}
这个例外的原因是什么?任何帮助将不胜感激