protected void Page_Load(object sender, EventArgs e) { string userName = Request.Form["txtName"]; string userPass = Request.Form["txtPassword"]; rr2.BLL.userInfo blluser = new rr2.BLL.userInfo(); if (blluser.Exists(userName, userPass)) { Response.Redirect("Aindex.aspx"); } else { Response.Write("<script>alert('请检查用户名和密码是否正确');window.location.href='getDemo.aspx'</script>"); } }
public void ProcessRequest(HttpContext context) /*在ProcessRequest下面写功能代码,区别于一般的处理程序*/ { context.Response.ContentType = "text/plain"; string userName = context.Request.Form["txtName"]; string userPass = context.Request.Form["txtPassword"]; rr2.BLL.userInfo blluser = new rr2.BLL.userInfo(); if (blluser.Exists(userName, userPass)) { context.Response.Redirect("Aindex.aspx"); } else { context.Response.Write("<script>alert('请检查用户名或者密码!');window.location.href='getDemo.aspx';</script>"); } }