示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            //解决跨域嵌套时iFrame子页面的Session无法访问
            Response.AddHeader("P3P", "CP=CAO PSA OUR");

            AjaxPro.Utility.RegisterTypeForAjax(typeof(iMES_Frame));

            //Get customer
            String strCustomer = Request["customer"];
            userInfo.Customer = strCustomer;

            //Get token
            String strToken = Request["Token"];
            IToken token = (IToken)WebCommonMethod.deserialize(strToken);

            //Init logon user information
            AuthorityManager authorManager = new AuthorityManager();
            AccountInfo account = authorManager.getAccountByToken(token);

            //Modify: ITC-1103-0150
            if (account.Login.Contains("\\"))
                userInfo.UserId = (String)account.Login.Split(new Char[] { '\\' })[1]; //itcxxxxxx
            else
                userInfo.UserId = (String)account.Login;

            userInfo.UserName = (String)account.Name;
            userInfo.Department = (String)account.Department;
            userInfo.Domain = (String)account.Domain;
            userInfo.Company = (String)account.Company;
            userInfo.AccountId = (long)account.Id;
            userInfo.Login = (String)account.Login; //itc\itcxxxxxx
            //Vincent add application info
            userInfo.Application = account.Application;

            Session["UserId"] = userInfo.UserId;

            //Init treeview
            TreeViewControl treeVC = new TreeViewControl(userInfo);
            treeVC.TreeNodePopulate(treeFunction.Nodes, token);
            Session["iMES_treeNodes"] = treeVC.getTreeNodes();
        }
    }
 private void checkAccount()
 {
     String strToken = Session["Token"].ToString();
     if (!string.IsNullOrEmpty(strToken))
     {
         IToken token = (IToken)WebCommonMethod.deserialize(strToken);
         //Init logon user information
         AuthorityManager authorManager = new AuthorityManager();
         try
         {
             com.inventec.RBPC.Net.entity.AccountInfo account = authorManager.getAccountByToken(token);
         }
         catch (Exception ex)
         {
             logger.Error(ex);
             //string strMsg = Resources.iMESGlobalMessage.ResourceManager.GetString(languagePre + "SessionIsNull");
             string strMsg = "SessionIsNull";
             Server.Transfer(Request.ApplicationPath + "/RedirectErrMsg.aspx?Message=" + HttpUtility.UrlEncode(strMsg));
         }
     }
     else
     {
         //string strMsg = Resources.iMESGlobalMessage.ResourceManager.GetString(languagePre + "SessionIsNull");
         string strMsg = "SessionIsNull";
         Server.Transfer(Request.ApplicationPath + "/RedirectErrMsg.aspx?Message=" + HttpUtility.UrlEncode(strMsg));
     }
 }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            logger.Debug("Page_Load Begin");
            //解决跨域嵌套时iFrame子页面的Session无法访问
            Response.AddHeader("P3P", "CP=CAO PSA OUR");

            AjaxPro.Utility.RegisterTypeForAjax(typeof(iMES_Frame));

            //Get customer
            String strCustomer = Request["customer"];
            userInfo.Customer = strCustomer;

            //Get token
            String strToken = Request["Token"];
            IToken token = (IToken)WebCommonMethod.deserialize(strToken);

            //Init logon user information
            AuthorityManager authorManager = new AuthorityManager();
            AccountInfo account = null;
            try
            {
                account = authorManager.getAccountByToken(token);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                string strMsg = Resources.iMESGlobalMessage.ResourceManager.GetString(Pre + "SessionIsNull");
                Server.Transfer(Request.ApplicationPath + "/RedirectErrMsg.aspx?Message=" + HttpUtility.UrlEncode(strMsg));
            }
            logger.DebugFormat("IMES_Frame Token:{0}", strToken);
            //Modify: ITC-1103-0150
            if (account.Login.Contains("\\"))
                userInfo.UserId = (String)account.Login.Split(new Char[] { '\\' })[1]; //itcxxxxxx
            else
                userInfo.UserId = (String)account.Login;

            userInfo.UserName = (String)account.Name;
            userInfo.Department = (String)account.Department;
            userInfo.Domain = (String)account.Domain;
            userInfo.Company = (String)account.Company;
            userInfo.AccountId = (long)account.Id;
            userInfo.Login = (String)account.Login; //itc\itcxxxxxx
            //Vincent add application info
            userInfo.Application = account.Application;
           
            Session["UserId"] = userInfo.UserId;
            string SessionId = Request["SessionId"];

            logger.DebugFormat("IMES_Frame RBPC UserId:{0} AccountId:{1} UserName:{2} Login:{3} SessionId:{4}", 
                                            userInfo.UserId,
                                            account.Id.ToString(),
                                            account.Name,
                                            account.Login,
                                            SessionId);

            Session[SessionId] = SessionId;
            Session[SessionId + "-UserId"] = userInfo.UserId;
            //Session["Token"] = strToken;            
            //Init treeview
            TreeViewControl treeVC = new TreeViewControl(userInfo);
            treeVC.TreeNodePopulate(treeFunction.Nodes, token, SessionId);
            Session["iMES_treeNodes"] = treeVC.getTreeNodes();
            logger.Debug("Page_Load End");
        }
    }