Exemplo n.º 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text.Length == 0)
        {
            Label1.Visible = true;
            Label2.Visible = false;
        }
        else if (TextBox2.Text.Length == 0)
        {
            Label1.Visible = false;
            Label2.Visible = true;
        }
        else
        {
            Label1.Visible = Label2.Visible = false;

            if (s.Login(TextBox1.Text, TextBox2.Text))
            {
                Session["username"] = TextBox1.Text;
                Session["dmlxpd"]   = "gm";
                Response.Redirect("Main.aspx");
            }
            else
            {
                Response.Write("<script>alert('用户名或密码错误!')</script>");
            }
        }
    }