protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (Page.IsValid) { if (sValidator == Code.Text.ToString()) { AdminSystem adminSystem = new AdminSystem(); Admin admin = new Admin(); admin = adminSystem.Get_SingAdmin(UserName.Text.ToString()); if (admin.UserName == UserName.Text.ToString()) { if (FormsAuthentication.HashPasswordForStoringInConfigFile(PassWord.Text.ToString(), "MD5") == admin.Password.ToString()) { Session["Admin_User"] = UserName.Text.ToString(); Response.Redirect("Default.aspx", false); } else { Response.Write("<script>alert('管理员密码错误');location.href='login.aspx';</script>"); } } else { Response.Write("<script>alert('管理员不存在');location.href='login.aspx';</script>"); } } else { Response.Write("<script>alert('验证码错误');location.href='login.aspx';</script>"); } } }
public void BinData() { AdminSystem adminSystem = new AdminSystem(); Admin admin = new Admin(); admin = adminSystem.Get_SingAdmin(sUserName); ID.Value = admin.ID.ToString(); UserName.Text = admin.UserName; LastLoginIP.Value = admin.LastLoginIP; LastLoginTime.Value = admin.LastLoginTime.ToString(); }