当Captcha Control添加时,提交功能停止工作

时间:2014-01-15 17:12:25

标签: c# asp.net createuserwizard

我把一切都搞好了,然后当我放入Captcha控件时,它停止了它创建用户的功能。

因此,如果我从aspx页面中删除控件,它可以正常工作并直接进入CreatingUser函数。

- aspx -

<asp:CreateUserWizard ID="RegisterUser" runat="server" EnableViewState="true" 
    OnCreatedUser="RegisterUser_CreatedUser" 
    OnCreatingUser="RegisterUser_CreatingUser">

 <cc1:CaptchaControl id="CControl" runat="server" CaptchaBackgroundNoise="Low" CaptchaFontWarping="Low" CaptchaLineNoise="Low" CaptchaMaxTimeout="300" ></cc1:CaptchaControl>

- 代码背后 -

protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
 {
        Captcha.V2.CaptchaControl mycaptcha = (Captcha.V2.CaptchaControl)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("CControl");

        mycaptcha.Validate();

        Boolean answer = mycaptcha.IsValid;
        if (answer == false)
        {
            e.Cancel = true;
        }   
    // Testing area where it worked before just to see...
    //
    //  .....
 }

0 个答案:

没有答案