protected void Button1_Click(object sender, EventArgs e) { string username = TextBox1.Text; string password = TextBox2.Text; Userinfo us = new Userinfo(); bool isexit = us.checklogin(username, password); if (isexit) { Session["username"] = username; Response.Redirect("default.aspx"); } else { Response.Write("<script>alert('信息错误');</script>"); } }