Controller中重写OnActionExecutingprotected override void OnActionExecuting(ActionExecutingContext filterContext){if (user == null){filterContext.HttpContext.Response.Redirect("/user/login");}base.OnActionExecuting(filterContext);}然后还有一个方法public ActionResult orderlist(byte status = 0, int pageIndex = 1){int rowCount = 0;List<OrderModel> list = todo.....return View(list);}问题:当user为null,而我要访问orderlist方法。按我的理解是先进OnActionExecuting,判断user为null,就转向到user/login方法,可是实际时先OnActionExecuting,然后进orderlist,再转到user/login 方法为何?
添加回答
举报
0/150
提交
取消