protected void Bt_login_Click(object sender, EventArgs e) { string expertID = txtUserID.Text; string expertPwd = txtUserPwd.Text; Expert expert = new Expert(); int flag = expert.Login(expertID, expertPwd); if (flag == 1) { expert.LoadInfo(expertID); Response.Cookies["userID"].Value = txtUserID.Text; Response.Cookies["userID"].Expires = DateTime.Now.AddDays(7); Response.Cookies["userName"].Value = expert.expertName; Response.Cookies["userName"].Expires = DateTime.Now.AddDays(7); Response.Cookies["userPwd"].Value = txtUserPwd.Text; Response.Cookies["userPwd"].Expires = DateTime.Now.AddDays(7); Response.Redirect("main.htm"); } else if (flag == -1) { Response.Write("<Script Language=JavaScript>alert(\"密码错误!\")</Script>"); } else if (flag == 0) { Response.Write("<Script Language=JavaScript>alert(\"用户名不存在!\")</Script>"); } }
protected void Bt_login_Click(object sender, EventArgs e) { string expertID = txtUserID.Text; string expertPwd = txtUserPwd.Text; Expert expert = new Expert(); int flag = expert.Login(expertID, expertPwd); if (flag == 1) { expert.LoadInfo(expertID); Response.Cookies["userID"].Value = txtUserID.Text; Response.Cookies["userID"].Expires = DateTime.Now.AddDays(7); Response.Cookies["userName"].Value = expert.expertName; Response.Cookies["userName"].Expires = DateTime.Now.AddDays(7); Response.Cookies["userPwd"].Value = txtUserPwd.Text; Response.Cookies["userPwd"].Expires = DateTime.Now.AddDays(7); Response.Redirect("main.htm"); } else if (flag == -1) { Response.Write("<Script Language=JavaScript>alert(\"密码错误!\")</Script>"); } else if (flag == 0) { Response.Write("<Script Language=JavaScript>alert(\"用户名不存在!\")</Script>"); } }