我认为这个问题说明了一切, 使用Register.aspx中的默认模板,我已经用Captcha控件定制了CreateUserWizard,我也有要检查一些业务逻辑添加用户之前,我曾尝试以下方法,但它没有工作,用户被添加反正即使e.Cancel为True如何在ASP.NET中添加用户之前验证用户条目 - CreateUserWizard
Protected Sub CreateUserWizard1_CreatingUser(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs) Handles CreateUserWizard1.CreatingUser
Dim Captcha As RecaptchaControl = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("recaptcha1"), RecaptchaControl)
If Not (Captcha.IsValid and ValidateUserEntries) Then
e.Cancel = True
End If
End Sub
任何建议,我会怎样做这个?
嗯......你确定你设置e.Cancel为真? – aquinas 2012-07-20 05:19:50
顺便说一句,除了我的回答,我想品脱的是,你的代码看起来不错。如果您的验证被绕过,它只是意味着它是有效的,所以我建议你仔细检查您的验证规则,因为设置'e.Cancel = TRUE;实际执行技巧停止新用户的创建 – Jupaol 2012-07-20 07:03:05