protected void Page_Load(object sender, EventArgs e) { if (SessionHelper.FetchSessionToken(Page.Session) == null) { UserNotLoggedInSoAbandonSessionAndRedirectToLoginPage(); } else { // Page.Request.UserHostAddress var ws = new FICAAS.FICAAS(); var appcode = WebConfigurationManager.AppSettings["AppCode_T"].ToString(); var ip = ErecruitHelper.GetIP(HttpContext.Current); if (!ws.UpdateLastActivityTime(SessionHelper.FetchSessionToken(Page.Session), ip, Page.Request.Url.AbsoluteUri, appcode)) { var ss = SessionHelper.FetchSessionToken(Page.Session); if (!string.IsNullOrEmpty(ss)) { Response.Redirect("SessionExpired.aspx", false); } else { UserNotLoggedInSoAbandonSessionAndRedirectToLoginPage(); } } else { //ShowPermissibleMenu(); wlcmLbl.Text = string.Format("Welcome: {0}", SessionHelper.FetchFirstName(Page.Session) + " " + SessionHelper.FetchLastName(Page.Session)); } } }
private void SetUserRoleAndPermissions() { var ws = new FICAAS.FICAAS(); var appcode = WebConfigurationManager.AppSettings["AppCode_T"].ToString(); var ip = ErecruitHelper.GetIP(HttpContext.Current); var roles = ws.FetchUserRoles(SessionHelper.FetchSessionToken(Session), appcode, ip); var permissions = ws.FetchUserPermissions(SessionHelper.FetchSessionToken(Session), appcode, ip); SessionHelper.SetUserRoles(roles, Session); SessionHelper.SetUserPermissions(permissions, Session); }
protected void LinkButton1_Click(object sender, EventArgs e) { var ws = new FICAAS.FICAAS(); ws.LogoutUser(SessionHelper.FetchSessionToken(Session), Request.UserHostAddress); SessionHelper.NullSessionToken(Session); SessionHelper.NullEmail(Session); SessionHelper.FetchUserId(Session); var ficaaslogin = WebConfigurationManager.AppSettings["FicassLoginUrl"].ToString(); Response.Redirect(ficaaslogin); }
protected void Page_Init(object sender, EventArgs e) { var ficassws = new FICAAS.FICAAS(); string authtoken = ""; string appcode = WebConfigurationManager.AppSettings["AppCode_T"].ToString(); if (Request.QueryString["token"] != null || SessionHelper.FetchSessionToken(Page.Session) == null) { //Page.Request.UserHostAddress authtoken = Request.QueryString["token"].ToString(); var ip = ErecruitHelper.GetIP(HttpContext.Current); var sessionToken = ficassws.FetchAppSessionToken(authtoken, ip, appcode); if (sessionToken != "") { SessionHelper.SetSessionToken(sessionToken, Session); var Userdata = ficassws.FetchUserData(sessionToken, ip); if (Userdata != null) { SessionHelper.SetEmail(Userdata.Email, Session); SessionHelper.SetUserId(Userdata.UserId, Session); SessionHelper.SetUserName(Userdata.Username, Session); SessionHelper.SetSol(Userdata.Sol, Session); SessionHelper.SetFirstName(Userdata.FirstName, Session); SessionHelper.SetStaffId(Userdata.StaffId, Session); SessionHelper.SetLastName(Userdata.LastName, Session); SetUserRoleAndPermissions(); //CheckIfUserHasProfile(db); } } else if (SessionHelper.FetchSessionToken(Page.Session) == null) { var ficaaslogin = WebConfigurationManager.AppSettings["FicassLoginUrl"].ToString(); Response.Redirect(ficaaslogin); } } else if (SessionHelper.FetchSessionToken(Page.Session) != null) { return; } else { var ficaaslogin = WebConfigurationManager.AppSettings["FicassLoginUrl"].ToString(); Response.Redirect(ficaaslogin); } }