J
Jeff
Hey
asp.net 2.0
I'm creating a web site where people must register to get access to
restricted area. In the CreateUserWizard control I've added a check on email
is unique (see the code below).. The problem is that this UniqueEmail method
isn't triggered when leaving the Email field or submitting the
CreateUserWizard (click on the finish button)
<asp:CustomValidator ID="valUniqueEmail" runat="server" ErrorMessage="Your
Email address is already taken" ControlToValidate="Email"
OnServerValidate="UniqueEmail"></asp:CustomValidator>
protected void UniqueEmail(object source, ServerValidateEventArgs args)
{
MembershipUserCollection allUsers = Membership.GetAllUsers();
Debug.WriteLine("UniqueEmail");
foreach (MembershipUser user in allUsers)
{
if (user.Email == args.Value)
{
Debug.WriteLine("Testing " + user.UserName + " against " +
args.Value);
args.IsValid = false;
}
}
}
Any suggestions?
Jeff
asp.net 2.0
I'm creating a web site where people must register to get access to
restricted area. In the CreateUserWizard control I've added a check on email
is unique (see the code below).. The problem is that this UniqueEmail method
isn't triggered when leaving the Email field or submitting the
CreateUserWizard (click on the finish button)
<asp:CustomValidator ID="valUniqueEmail" runat="server" ErrorMessage="Your
Email address is already taken" ControlToValidate="Email"
OnServerValidate="UniqueEmail"></asp:CustomValidator>
protected void UniqueEmail(object source, ServerValidateEventArgs args)
{
MembershipUserCollection allUsers = Membership.GetAllUsers();
Debug.WriteLine("UniqueEmail");
foreach (MembershipUser user in allUsers)
{
if (user.Email == args.Value)
{
Debug.WriteLine("Testing " + user.UserName + " against " +
args.Value);
args.IsValid = false;
}
}
}
Any suggestions?
Jeff