Exemplo n.º 1
0
        protected override void OnPreLoad(EventArgs e)
        {
            base.OnPreLoad(e);

            string loginID = LoginManager.GetLoginID();

            if (string.IsNullOrEmpty(loginID))
            {
                this.TopWindowLocation(ConfigManager.GetLoginPageUrl());
                return;
            }
            else
            {
                AppUser appUser = BFPInstance.InitAppUser(loginID.ToInt32()).Result;
                this.WorkUser = appUser;
                Session[ConfigManager.GetSignInAppUserSessionName()] = WorkUser;
            }



            //下面的代码防止A用户打开的页面,B用户登录进来,操作前面A用户打开的页面,造成数据错乱
            if (!Page.IsPostBack)
            {
                this.ViewState.Add("PageOpenedByThisUser", WorkUser.UserID);
            }
            else
            if (WorkUser.UserID != this.ViewState["PageOpenedByThisUser"].ToString())
            {
                Response.Write("页面用户信息已过期!");
                Response.End();
            }
        }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         op = Request.QueryString["exit"].ToString2();
         if (op == "exit")
         {
             Session.RemoveAll();
         }
         object sessionUserID = System.Web.HttpContext.Current.Session["UserID"];
         if ((sessionUserID != null) || (sessionUserID.ToString2().Trim() != string.Empty))
         {
             int loginid = Convert.ToInt32(sessionUserID);
             WorkUser = BFPInstance.InitAppUser(loginid).Result;
             Session[ConfigManager.GetSignInAppUserSessionName()] = WorkUser;
             if (WorkUser.UserType == UserType.管理用户)
             {
                 Response.Redirect("Index.aspx");
             }
         }
     }
 }