/// <summary> /// /// </summary> /// <returns></returns> protected virtual ILogOnUserInfo GetLogOnUserInfoObject() { // if (Session["logonUserInfo"] == null) // { // if (Context.User.Identity.Name.Length == 0) // { // Session["logonUserInfo"] = GlobalInfo.UserLogOnInfo; // string strMsg = "对不起,系统没有获取到您的登录信息数据!请重新登录系统!"; // HG.HGSupport.Common.CtrlException.TrueThrow(Session["logonUserInfo"] == null, strMsg); // } // else // Session["logonUserInfo"] = new LogOnUserInfo(HttpContext.Current); // } // // return (ILogOnUserInfo)Session["logonUserInfo"]; ILogOnUserInfo ilou = null; if (Context.User.Identity.Name.Length == 0) { ilou = GlobalInfo.UserLogOnInfo; string strMsg = "对不起,系统没有获取到您的登录信息数据!请重新登录系统!"; ExceptionHelper.TrueThrow(ilou == null, strMsg); } else { ilou = new LogOnUserInfo(HttpContext.Current); } return(ilou); }
private void SetShowMyOrgValue() { // LShowMyOrg.Value = GetRequestData("ShowMyOrg", 0).ToString(); // 是否展现当前操作人员所在的机构(cgac\yuanyong [20041101]) if (GetParamData("ShowMyOrg", 0).ToString() == "1") { string strAutoExpand = LAutoExpand.Value.Trim(); ILogOnUserInfo lou = GlobalInfo.UserLogOnInfo; if (lou != null) { string strTemp = lou.OuUsers[0].AllPathName; string strParentAllPathName = strTemp.Substring(0, strTemp.LastIndexOf("\\")); XmlDocument xmlDoc = new XmlDocument(); if (strAutoExpand != string.Empty) { xmlDoc.LoadXml(strAutoExpand); } else { xmlDoc.LoadXml("<root />"); } XmlElement objXml = (XmlElement)XmlHelper.AppendNode(xmlDoc.DocumentElement, "object"); objXml.SetAttribute("ALL_PATH_NAME", strParentAllPathName); LAutoExpand.Value = xmlDoc.OuterXml; } } }
/// <summary> /// 重载页面加载,调用了Page类的OnLoad(e)事件 /// </summary> /// <param name="e">事件参数</param> protected override void OnLoad(EventArgs e) { _LogOnUserInfo = GetLogOnUserInfoObject(); GlobalInfo.InitLogOnUser(_LogOnUserInfo); base.OnLoad(e); }
/// <summary> /// /// </summary> /// <returns></returns> protected virtual ILogOnUserInfo GetLogOnUserInfoObject() { // if (Session["logonUserInfo"] == null) // { // if (Context.User.Identity.Name.Length == 0) // { // Session["logonUserInfo"] = GlobalInfo.UserLogOnInfo; //// if (Session["logonUserInfo"] == null) //// { //// if (Response.Cookies[FormsAuthentication.FormsCookieName] != null) //// { //// FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(Response.Cookies[FormsAuthentication.FormsCookieName].Value); //// HttpContext context = HttpContext.Current; //// //// IIdentity id = new GenericIdentity(ticket.Name); //// string[] strRoles = {""}; //// context.User = new GenericPrincipal(id, strRoles); //// //// Session["logonUserInfo"] = new LogOnUserInfo(HttpContext.Current); //// } //// } // string strMsg = "对不起,系统没有获取到您的登录信息数据!请重新登录系统!"; // HG.HGSupport.Common.CtrlException.TrueThrow(Session["logonUserInfo"] == null, strMsg); // } // else // Session["logonUserInfo"] = new LogOnUserInfo(HttpContext.Current); // } // // return (ILogOnUserInfo)Session["logonUserInfo"]; ILogOnUserInfo ilou = null; if (Context.User.Identity.Name.Length == 0) { ilou = GlobalInfo.UserLogOnInfo; string strMsg = "对不起,系统没有获取到您的登录信息数据!请重新登录系统!"; ExceptionHelper.TrueThrow(ilou == null, strMsg); } else { ilou = new LogOnUserInfo(HttpContext.Current); } return(ilou); }
// private void SetUserPrincipal(string strUserName) // { // HttpContext context = HttpContext.Current; // // IIdentity id = new GenericIdentity(strUserName); // string[] strRoles = {""}; // context.User = new GenericPrincipal(id, strRoles); // } /// <summary> /// 重载页面加载,调用了Page类的OnLoad(e)事件 /// </summary> /// <param name="e">事件参数</param> protected override void OnLoad(EventArgs e) { _LogOnUserInfo = GetLogOnUserInfoObject(); GlobalInfo.InitLogOnUser(_LogOnUserInfo); base.OnLoad(e); }
/// <summary> /// 根据登录用户身份初始化用户信息数据 /// </summary> /// <param name="userInfo"></param> public static void InitLogOnUser(ILogOnUserInfo userInfo) { _LogOnUserInfoSlot = Thread.AllocateDataSlot(); Thread.SetData(_LogOnUserInfoSlot, userInfo); }