Controller中重寫OnActionExecutingprotected override void OnActionExecuting(ActionExecutingContext filterContext){if (user == null){filterContext.HttpContext.Response.Redirect("/user/login");}base.OnActionExecuting(filterContext);}然后還有一個(gè)方法public ActionResult orderlist(byte status = 0, int pageIndex = 1){int rowCount = 0;List<OrderModel> list = todo.....return View(list);}問題:當(dāng)user為null,而我要訪問orderlist方法。按我的理解是先進(jìn)OnActionExecuting,判斷user為null,就轉(zhuǎn)向到user/login方法,可是實(shí)際時(shí)先OnActionExecuting,然后進(jìn)orderlist,再轉(zhuǎn)到user/login 方法為何?
- 1 回答
- 0 關(guān)注
- 735 瀏覽
添加回答
舉報(bào)
0/150
提交
取消