简体   繁体   English

CreateUserWizard的服务器端验证

[英]Server-side validation for CreateUserWizard

I am using the built-in asp.net membership framework. 我正在使用内置的asp.net成员资格框架。 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. 我创建了一个注册页面,并使用一些自定义验证器设置了客户端验证,并通过jQuery AJAX验证了Web服务,并且客户端验证工作正常。 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? 如何在CreateUserWizard中实现服务器端验证? Can you point me at some specific tutorial? 您能指出一些具体的教程吗? I failed to find one. 我找不到一个。

Thank you! 谢谢!

Use event CreatingUser . 使用事件CreatingUser

Markup: 标记:

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

Code: 码:

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

Please look on the following tutorials for full information about the CreateUserWizard: Customizing the CreateUserWizard Control . 请查看以下教程,以获取有关CreateUserWizard的完整信息: 自定义CreateUserWizard控件

Another helpful tutorial can be found here: Customizing ASP.NET's CreateUserWizard Control To Display a Fixed Set of Security Questions 在此处可以找到另一个有用的教程: 自定义ASP.NET的CreateUserWizard控件以显示固定的安全问题集

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM