protected void btnLogin_Click(object sender, EventArgs e) { string userRole = ddlUserRole.SelectedItem.Text.Trim(); string loginID = txtUserName.Text.Trim(); string password = txtPassword.Text.Trim(); if (userRole == "管理员") { string message = adminManage.AdminSSO(loginID, password); if (message.Trim() == "成功") { Admin admin = new Admin(); admin.LoginID = loginID; admin.LoginPass = password; Session["admin"] = admin; Response.Redirect("Admin/AuditUpLoadTitle.aspx"); } else { lblLoginMessage.Text = message; } } else if (userRole == "教师") { string message = teacherManage.TeacherSSO(loginID, password); if (message.Trim() == "成功") { Teacher teacher = teacherManage.GetTeacherByTeacherID(loginID); Session["teacher"] = teacher; Session["TEID"] = teacher.TEID; Response.Redirect("Teacher/TeacherMessage.aspx"); } else { lblLoginMessage.Text = message; } } else if (userRole == "学生") { string message = studentManage.StudentSSO(loginID, password); if (message.Trim() == "成功") { Student student = studentManage.GetStudentByStudentID(loginID); Session["student"] = student; Response.Redirect("Student/StudentMessage.aspx"); } else { lblLoginMessage.Text = message; } } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择用户角色!');</script>"); } }