protected void Page_Load(object sender, EventArgs e) { string strEmployeeId = string.Empty; try { if (Request.QueryString["UserName"] != null) { //MSU SSO strEmployeeId = Request.QueryString["userName"].ToString(); this.TrackLog("User from MSU: " + strEmployeeId, 0); } else if (Request["UserName"] != null) { //blackboard SSO strEmployeeId = Decrypt(Request["UserName"].ToString(), System.Configuration.ConfigurationManager.AppSettings["SSOSaltKey"].ToString()); this.TrackLog("User from Blackboard: " + strEmployeeId, 0); } else if (Request["lis_person_sourcedid"] != null && Request["custom_lms"] != null && Request["oauth_consumer_key"] != null && Request["oauth_consumer_key"].ToString() == System.Configuration.ConfigurationManager.AppSettings["SSOSaltKey"].ToString() && Request["custom_lms"].ToString().Equals("BB")) { strEmployeeId = Request["lis_person_sourcedid"].ToString(); this.TrackLog("User from Blackboard Ultra: " + strEmployeeId, 0); } else if (Request["user_id"] != null && Request["custom_lms"] != null && Request["oauth_consumer_key"] != null) { if (Request["oauth_consumer_key"].ToString() == System.Configuration.ConfigurationManager.AppSettings["D2LSaltKey"].ToString() && Request["custom_lms"].ToString().Equals("2")) { if (Request["user_id"].ToString().Contains("_")) { //d2l string[] ls = Request["user_id"].ToString().Split('_'); strEmployeeId = ls[1].ToString(); this.TrackLog("User from D2L: " + strEmployeeId, 0); } if (Request["user_id"].ToString().Contains("::")) { //schoology string[] ls = Request["user_id"].ToString().Split(':'); string[] ls1 = ls[0].ToString().Split(':'); strEmployeeId = ls1[0].ToString(); this.TrackLog("User from Schoology: " + strEmployeeId, 0); } } else if (Request["oauth_consumer_key"].ToString() == System.Configuration.ConfigurationManager.AppSettings["SakaiSaltKey"].ToString() && Request["custom_lms"].ToString().ToLower().Equals("sakai")) { //sakai strEmployeeId = Request["user_id"].ToString(); this.TrackLog("User from Sakai: " + strEmployeeId, 0); } else if (Request["oauth_consumer_key"].ToString() == System.Configuration.ConfigurationManager.AppSettings["AtrixSaltKey"].ToString() && Request["custom_lms"].ToString().Equals("atrix")) { // atrix strEmployeeId = Request["user_id"].ToString(); this.TrackLog("User from Atrix LMS: " + strEmployeeId, 0); } else if (Request["lis_person_contact_email_primary"] != null && Request["oauth_consumer_key"].ToString() == System.Configuration.ConfigurationManager.AppSettings["Jenzabar"].ToString() && Request["custom_lms"].ToString().Equals("Jenzabar")) { // Jenzabar strEmployeeId = Request["lis_person_contact_email_primary"].ToString(); this.TrackLog("User from Jenzabar LMS: " + strEmployeeId, 0); } } } catch { strEmployeeId = "Error: "; } if (strEmployeeId == string.Empty) { this.TrackLog(ErrorMessages.GetErrorMessage(1004).ToString(), 0); this.ErrorLog(1004); } else if (strEmployeeId.Contains("Error:")) { this.ErrorLog(Convert.ToInt32(strEmployeeId.Replace("Error:", ""))); } else { BEUser objBEUser = new BEUser(); BUser objBUser = new BUser(); objBEUser.strStudentCode = strEmployeeId; objBUser.BFindUser(objBEUser); if (objBEUser.IntResult != 0) { Session[BaseClass.EnumPageSessions.USERID] = objBEUser.IntUserID; Session["UserName"] = objBEUser.StrUserAliasName; Session["EmailID"] = objBEUser.StrUserName; Session["TimeZoneID"] = objBEUser.IntTimeZoneID.ToString(); Session["TimeZone"] = objBEUser.StringTimeZone.ToString(); Session["RoleID"] = objBEUser.IntRoleID.ToString(); Session[BaseClass.EnumPayment.PaidBY_ExamFee] = objBEUser.PaidBy_ExamFee.ToString(); Session[BaseClass.EnumPayment.PaidBY_OndeMand] = objBEUser.PaidBy_OndemandFee.ToString(); if (objBEUser.intDualRole == 0) { if (objBEUser.IntRoleID == 6) { if (ConfigurationManager.AppSettings["ExamityMeetingValidation"] != null && ConfigurationManager.AppSettings["ExamityMeetingValidation"].ToString().Equals("Yes")) { if ((browser.Browser.ToString().Trim() == "Firefox") || (browser.Browser.ToString().Trim() == "Chrome")) { Response.Redirect("Student/Home.aspx", false); } else { Session.Abandon(); Response.Redirect("Detect.aspx", false); } } else { Response.Redirect("Student/Home.aspx", false); } } else if (objBEUser.IntRoleID == 3) { if (ValidateTimeZone()) { Response.Redirect(BaseClass.EnumAppPage.COMMON_CHANGETIMEZONE, false); } else { Response.Redirect(BaseClass.EnumAppPage.PROVIDER_HOME, false); } } else if (objBEUser.IntRoleID == 7) { if (ValidateTimeZone()) { Response.Redirect(BaseClass.EnumAppPage.COMMON_CHANGETIMEZONE, false); } else { Response.Redirect("Admin/Home.aspx", false); } } else if (objBEUser.IntRoleID == 8) { if (ValidateTimeZone()) { Response.Redirect(BaseClass.EnumAppPage.COMMON_CHANGETIMEZONE, false); } else { Response.Redirect("CourseAdmin/Home.aspx", false); } } } else { Session["DUALROLE"] = objBEUser.DsResult; Response.Redirect("switchrole.aspx?ID=1", false); } } else { this.TrackLog(strEmployeeId + " " + ErrorMessages.GetErrorMessage(3001).ToString(), 0); this.ErrorLog(3001); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Form["oauth_consumer_key"] != null && Request.Form["oauth_consumer_key"].ToString() == System.Configuration.ConfigurationManager.AppSettings["LMSConsumerKey"].ToString()) { BEUser objBEUser = new BEUser(); BUser objBUser = new BUser(); objBEUser.strStudentCode = Request.Form["lis_person_contact_email_primary"]; strEmployeeId = objBEUser.strStudentCode; this.TrackLog("User from Canvas or Moodlre or Learning studio LMS: " + strEmployeeId, 0); objBUser.BFindUser(objBEUser); if (objBEUser.IntResult != 0) { Session[BaseClass.EnumPageSessions.USERID] = objBEUser.IntUserID; Session["UserName"] = objBEUser.StrUserAliasName; Session["EmailID"] = objBEUser.StrUserName; Session["TimeZoneID"] = objBEUser.IntTimeZoneID.ToString(); Session["TimeZone"] = objBEUser.StringTimeZone.ToString(); Session["RoleID"] = objBEUser.IntRoleID.ToString(); Session[BaseClass.EnumPayment.PaidBY_ExamFee] = objBEUser.PaidBy_ExamFee.ToString(); Session[BaseClass.EnumPayment.PaidBY_OndeMand] = objBEUser.PaidBy_OndemandFee.ToString(); if (objBEUser.intDualRole == 0) { if (objBEUser.IntRoleID == 6) { if (ConfigurationManager.AppSettings["ExamityMeetingValidation"] != null && ConfigurationManager.AppSettings["ExamityMeetingValidation"].ToString().Equals("Yes")) { if ((browser.Browser.ToString().Trim() == "Firefox") || (browser.Browser.ToString().Trim() == "Chrome")) { Response.Redirect("Student/Home.aspx", false); } else { Session.Abandon(); Response.Redirect("Detect.aspx", false); } } else { Response.Redirect("Student/Home.aspx", false); } } else if (objBEUser.IntRoleID == 3) { if (ValidateTimeZone()) { Response.Redirect(BaseClass.EnumAppPage.COMMON_CHANGETIMEZONE, false); } else { Response.Redirect(BaseClass.EnumAppPage.PROVIDER_HOME, false); } } else if (objBEUser.IntRoleID == 7) { if (ValidateTimeZone()) { Response.Redirect(BaseClass.EnumAppPage.COMMON_CHANGETIMEZONE, false); } else { Response.Redirect("Admin/Home.aspx", false); } } else if (objBEUser.IntRoleID == 8) { if (ValidateTimeZone()) { Response.Redirect(BaseClass.EnumAppPage.COMMON_CHANGETIMEZONE, false); } else { Response.Redirect("CourseAdmin/Home.aspx", false); } } } else { Session["DUALROLE"] = objBEUser.DsResult; Response.Redirect("switchrole.aspx?ID=1"); } } else { this.TrackLog(strEmployeeId + " " + ErrorMessages.GetErrorMessage(3001).ToString(), 0); Response.Redirect("Errors/SSOErrorPage.aspx?ErrorId=3001", true); } } else { Response.Redirect("Errors/SSOErrorPage.aspx?ErrorId=3001", true); } }