Server-side validation for CreateUserWizard

China☆狼群 提交于 2019-12-11 03:17:06

问题


I am using the built-in asp.net membership framework. I created a registration page and set up client-side validation with some custom validators, validating through jQuery AJAX to a web service and the client-side validation works ok. I have two issues:

  1. Even when the client-side validation fails, the continue button still works. How do I disable it?

  2. I don't want to count on client-side validation. How do I go about implementing server-side validation in the CreateUserWizard? Can you point me at some specific tutorial? I failed to find one.

Thank you!


回答1:


Use event CreatingUser.

Markup:

<asp:CreateUserWizard runat="server" CreatingUser="wizard_CreatingUser" />

Code:

protected void wizard_CreatingUser (object sender, LoginCancelEventArgs e)
{
    e.Cancel = ((CreateUserWizard)sender).UserName.Contains("!@#$%^&");
}



回答2:


Please look on the following tutorials for full information about the CreateUserWizard: Customizing the CreateUserWizard Control.

Another helpful tutorial can be found here: Customizing ASP.NET's CreateUserWizard Control To Display a Fixed Set of Security Questions



来源:https://stackoverflow.com/questions/5955280/server-side-validation-for-createuserwizard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!