コード例 #1
0
        public static byte Auto_Login_User()
        {
            String admin_User_Value = Tool.NTool.GetCookieValue(User_login_ck_name);

            string[] arr = admin_User_Value.Split('_');

            if (Tool.NStr.hasSessionValue(NModel.EnObject.CurrentLoginUserSessionName))
            {
                return(1);
            }
            else if (Tool.NTool.IsArrEqualLen <string>(arr, 2))
            {
                BLL.DB_Session bll_Session = new BLL.DB_Session();
                long           User_ID     = 0;
                long.TryParse(arr[1], out User_ID);
                bool has = bll_Session.Exists_CID_UserID(arr[0], User_ID);
                if (has)
                {
                    BLL.DB_User bll = new BLL.DB_User();
                    HttpContext.Current.Session[NModel.EnObject.CurrentLoginUserSessionName] = bll.GetModel((long?)User_ID);
                    bll.Close();
                    return(2);
                }
            }

            return(0);
        }
コード例 #2
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //删除登录状态
            BLL.DB_Session bll_Session = new BLL.DB_Session();
            bll_Session.DelOutTime();
            bll_Session.Close();

            //user = BLL.Fun.Current_Login_DB_User();

            //if (user == null)
            //{
            //    filterContext.Result = this.RedirectToAction("Index", "Main");

            //}

            base.OnActionExecuting(filterContext);
        }
コード例 #3
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            BLL.DB_Session bll_Session = new BLL.DB_Session();
            bll_Session.DelOutTime();
            bll_Session.Close();

            model_pager = LoadConfig("member");

            model_pager.IDictUserModel = new Dictionary <string, NModel.DB_User>();

            var user = BLL.Fun.Current_Login_DB_User();

            //用户是否登录
            if (user == null)
            {
                filterContext.Result = this.RedirectToAction("login", "mlcq");
            }

            base.OnActionExecuting(filterContext);
        }