protected void btnSubmit_Click(object sender, EventArgs e) { //验证码验证 if (Session["valid"].ToString().Trim().ToUpper() != tbxSecutity.Text.Trim().ToUpper()) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ggg", "<script language='javascript'>alert('" + "验证码错误" + "');</script> "); } else { StoreUser newUser = new StoreUser(); //创建新实体类对象 StoreUserController newUserCon = new StoreUserController(); //创建新方法类对象 newUser.UserName = this.tbxUserName.Text; //传参 newUser.PassWord = this.tbxPassWord.Text; newUser.Email = this.tbxEmail.Text; newUser.IdCardNum = this.tbxIdcard.Text; newUser.UserTrueName = this.tbxTruename.Text; if (newUserCon.RegistStoreUser(newUser) == true) { UA uAdmin = new UA(); uAdmin.SendEmail(newUser); this.Response.Redirect("tip_register.aspx");//页面跳转 } else { Response.Write("插入失败");//提示信息 } } }