protected void BtnLogin_Click(object sender, EventArgs e) { string userip = IPHelper.GetIP(); string trueVali = Session["Vnum"].ToString().ToUpper(); string userid = username.Text; string userPwd = rsa.decryptPwd(password.Text); User u = new User(); u = UserHelper.Login(username.Text, userPwd); if (IPHelper.CheckIsAble(userip, userid)) { if (check.Text.Trim().ToUpper() == trueVali) { if (u != null) { Session["User"] = u; //判断是否是root用户 if (u.Number != "htoorticuoh") { LogHelper.addLog(u.UserID); Response.Redirect("Index.aspx"); } else { Response.Redirect("./root/adminList.aspx"); } } else { IPHelper.AddTime(userip, userid); Response.Write("<script>alert('用户名或密码错误(输入错误5次后需等待5分钟后才可重复尝试)');location.href='login.aspx';</script>"); } } else { Response.Write("<script>alert('验证码错误');location.href='login.aspx';</script>"); } Session["Vnum"] = null; Session.Remove("Vnum"); } else { Response.Write("<script>alert('输错密码次数超过5次,请求失败');location.href='/Display/Index.aspx';</script>"); //Response.End(); } }