protected void SignButton_Click(object sender, EventArgs e) { if ((EmailTextBox1.Text != string.Empty) && (PasswordTextBox1.Text != string.Empty) && (NameTextBox1.Text != string.Empty)) { UersBLL newUserBll = new UersBLL(); bool IsCreatedSuccess = newUserBll.CreateUser(NameTextBox1.Text, EmailTextBox1.Text, PasswordTextBox1.Text); if (IsCreatedSuccess) { //创建成功 Session["UserEmail"] = EmailTextBox.Text.Trim(); if (Request.Cookies["UserEmail"] == null) { Response.Cookies["UserEmail"].Expires = DateTime.Now.AddDays(7); Response.Cookies["UserPassword"].Expires = DateTime.Now.AddDays(7); Response.Cookies["UserId"].Expires = DateTime.Now.AddDays(7); Response.Cookies["UserId"].Value = Convert.ToString(new UersBLL().GetUserId(EmailTextBox1.Text.ToString())); Response.Cookies["UserEmail"].Value = EmailTextBox1.Text.Trim(); Response.Cookies["UserPassword"].Value = PasswordTextBox1.Text.Trim(); } Response.Redirect("~/UserInfo.aspx"); } else { //创建失败 Response.Write("此邮箱已经存在"); } } else { Response.Write("信息填写不完整"); } }