Example #1
0
 protected void login_Click(object sender, EventArgs e)
 {
     Ma.username = this.UserName.Text.Trim();
     Ma.password = FormsAuthentication.HashPasswordForStoringInConfigFile(this.PassWord.Text.Trim(), "MD5");
     if (Ba.ReRowCount(Ma) > 0)
     {
         Session["admin"] = Ma.username.ToString();
         Response.Redirect("../Web/admin/Admin_Index.aspx");
     }
     if (Ba.UserLogin(Ma).Tables[0].Rows.Count > 0)
     {
         Session["username"] = Ma.username.ToString();
     }
     this.login_s.Visible = false;
     this.login_E.Visible = true;
     this.Label.Text      = Session["username"].ToString();
 }
Example #2
0
 protected void btn_Login_Click(object sender, EventArgs e)
 {
     if (UserName.Text.Equals(""))
     {
         Response.Write("<script language=javascript>alert('请输入管理员用户名!')</script>");
     }
     if (PassWord.Text.Equals(""))
     {
         Response.Write("<script language=javascript>alert('请输入管理员密码!')</script>");
     }
     Ma.username = UserName.Text.Trim();
     Ma.password = FormsAuthentication.HashPasswordForStoringInConfigFile(PassWord.Text.Trim(), "MD5");
     if (Ba.ReRowCount(Ma) > 0)
     {
         Session["admin"] = UserName.Text.Trim();
         Response.Redirect("Admin_Index.aspx");
     }
     else
     {
         //Response.Write("<script language=javascript>alert('登录失败,请从新登录!')</script>");
         //this.Error.Text = "登录失败,请从新登录!";
         Response.Redirect("Admin_Login.aspx");
     }
 }