protected override void Initialize(RequestContext requestContext) { base.Initialize(requestContext); //RMUrl = requestContext.HttpContext.Application["RMUrl"].ToString(); Response.Cache.SetCacheability(HttpCacheability.NoCache); if (SSO) { InitLanguage(requestContext); try { CustomPrincipal.TrySetUserInfo(requestContext.HttpContext.ApplicationInstance.Context); userData = ((CustomPrincipal)HttpContext.User).UserData; //WebUser.SignInOfGener( // new Emp() { No = userData.LoginName, Name = userData.LoginFullName } // , Session["Culture"].ToString(), userData.LoginName, true); } catch (Exception) { string cloudUrl = ConfigurationManager.AppSettings["SSOCloudURLAddress"]; requestContext.HttpContext.Response.Redirect(cloudUrl, true); return; } if (!userData.IsSuperAdmin && (Session["IsLogOut"] ?? "1").Equals("1")) { Session["IsLogOut"] = "0"; Session["Employee"] = userData; Session["LogicGUID"] = Guid.NewGuid().ToString(); Session["Timeout"] = Session.Timeout; Session["IP"] = this.HttpContext.Request.UserHostAddress; new Log().Loger(userData, Session["LogicGUID"].ToString(), Session["IP"].ToString(), RMUrl, Session.Timeout, true); } else { } } else { ResourceLoader.SetCurrentThreadCulture(Session); try { userData = ((CustomPrincipal)HttpContext.User).UserData; } catch (Exception) { } } }
private void HRAuthenticateRequest(object objSender, EventArgs objEventArgs) { //首先获取用户登陆信息 HttpApplication app = (HttpApplication)objSender; CustomPrincipal.TrySetUserInfo(app.Context); if (!IsBypass(app) && (HttpContext.Current.User == null || HttpContext.Current.User.Identity == null || !HttpContext.Current.User.Identity.IsAuthenticated)) { //HttpContext.Current.Response.Redirect("/Common/RedirectToLogin?Msg=" + Common.Access_Denied, true); } else { } }