Click here to Skip to main content
15,909,822 members
Please Sign up or sign in to vote.
4.43/5 (3 votes)
See more:
Hellow friends,i got a form have used asp. net membesrhip while submitting data.I have used the Membership property "Requires unique email".This brings up the error "An existing email exists."But the problem is that after it shows that message,it still goes ahead and submits data.Is their a way to stop it from submitting data at that point?Thanks]
Posted
Updated 14-Jan-14 1:20am
v2
Comments
navin ks 14-Jan-14 7:04am    
paste the code
Member 10398773 14-Jan-14 7:17am    
MembershipCreateStatus status;
MembershipUser Student = Membership.CreateUser(username, password,emailAdressRadtextbox.Text);
switch (status)
{

case MembershipCreateStatus.Success:
{
(here have got the code to insert all the other details)
Labeluser.text="Registered successfully";
}

case MembershipCreateStatus.DuplicateEmail:
{
labeluser.text="Email Exists,use new email";
break;
}
}

1 solution

two ways ,
1.Make email field in database as primary key.
2. MembershipCreateStatus.Success:
if true
{
search database for emailAdressRadtextbox.Text in email field, if data is present then dont insert
}
else
{
insert
}
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900