locked
create user wizard control ignores checking captcha RRS feed

  • Question

  • User-908650885 posted

    Hi friends ,

    I have to check captcha code if wrong, prevent user register, but create user wizard ingores it, why?

    protected void CreateUserWizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            TextBox captchatxt = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("TextBox1");
            Literal wrongcaptcha = (Literal)CreateUserWizardStep1.ContentTemplateContainer.FindControl("WrongCaptcha");
            
            if (Session["Captcha"].ToString() != captchatxt.Text)
            {
                wrongcaptcha.Text = "Wrong Captcha";
                captchatxt.Text = "";
            }
    
        }

    if wrong or right captcha user will register.

    what I have to do, plz help, thanks

    Saturday, June 7, 2014 10:12 AM

Answers

  • User-908650885 posted

    I've got my answer using this refrence:

    http://forums.asp.net/t/1536076.aspx

    so I write tht code inside of creating_user event and it worked.

    protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
        {
            TextBox captchatxt = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("TextBox1");
            Literal wrongcaptcha = (Literal)CreateUserWizardStep1.ContentTemplateContainer.FindControl("WrongCaptcha");
    
            if (Session["Captcha"].ToString() != captchatxt.Text)
            {
                wrongcaptcha.Text = "Wrong Captcha";
                captchatxt.Text = "";
                e.Cancel = true;
            }
        }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 7, 2014 11:26 AM