protected void change_ServerClick(object sender, EventArgs e) { if (validateNum.Value == Session["CheckCode"].ToString()) { MembershipCreateStatus status; Membership.CreateUser(userTxt.Value, password.Value, email.Value, question.Value, answer.Value, true, out status); if (status == MembershipCreateStatus.Success) { try { EmailSend es = new EmailSend(); es.sendRegEmail(email.Value, userTxt.Value, password.Value); } catch (Exception ee) { } finally { MultiView1.ActiveViewIndex = 3; Address.InsertAddress(userTxt.Value); Roles.AddUserToRole(userTxt.Value, "Member"); } } if (status == MembershipCreateStatus.DuplicateEmail) { DuplicateEmailTxt.Text = "此Email已被注册,请选择填写Email"; } } else { validateNumTxt.Text = "验证码输入有误,请重新输入验证码"; } }