Пример #1
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string uid       = txtName.Text.Trim();
        string upassowrd = txtPassword.Text.Trim();
        users  us        = new users();

        us.uid = uid;
        us.ups = upassowrd;
        if (drpIdentity.SelectedValue == "ad")
        {
            int result = us.Alogin(us);
            if (result > 0)
            {
                Session["id"] = uid;       //会话变量,网站通用,确定身份
                Response.Redirect("~/HomePage.aspx");
            }
            else
            {
                Response.Write("<script>alert(\"对不起,您输入错误!\")</script>");
            }
        }
        if (drpIdentity.SelectedValue == "us")
        {
            int result = us.ulogin(us);
            if (result > 0)
            {
                Session["id"] = uid;       //会话变量,网站通用,确定身份
                Response.Redirect("~/usershomepag.aspx");
            }
            else
            {
                Response.Write("<script>alert(\"对不起,您输入错误!\")</script>");
            }
        }
    }