How to determine if a registered user already exists (Membership authentication)

Source: Internet
Author: User
MembershipCreateStatus Istatus; Membership.CreateUser (username, password, email, question, answer, true, out istatus);
Errirmsgtext.visible = true;
Switch (istatus)
{
Case Membershipcreatestatus.success:
if (request.querystring["ReturnUrl"]!= null)
{
FormsAuthentication.RedirectFromLoginPage (username, false);
}
Else
{
Formsauthentication.setauthcookie (Username,false);
Response.Redirect ("~/default.aspx");
}
Errirmsgtext.text = "New user created successfully. ";
Break
Case Membershipcreatestatus.invalidusername:
Errirmsgtext.text = "Invalid user name. ";
Break
Case Membershipcreatestatus.duplicateemail:
Errirmsgtext.text = "Duplicate e-mail address. ";
Break
Case Membershipcreatestatus.invalidquestion:
Errirmsgtext.text = "Invalid password hint problem. ";
Break
Case Membershipcreatestatus.duplicateusername:
Errirmsgtext.text = "The user name is registered, please replace the user name." ";
Break
Case Membershipcreatestatus.invalidanswer:
Errirmsgtext.text = "Invalid password answer. ";
Break
Case Membershipcreatestatus.invalidemail:
Errirmsgtext.text = "Invalid e-mail address. ";
Break
Case Membershipcreatestatus.invalidpassword:
Errirmsgtext.text = "Password must be 7 digits, and has 1 special symbols." ";
Break
Default
Errirmsgtext.text = "An unknown error occurred. Please contact the site administrator. ";
Break
}
MembershipCreateStatus Istatus;
This thing returns the results of your registered user. The following SWICTH code block gives the corresponding hints based on this result

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.