过滤器属性的运行顺序

本文关键字:顺序 运行 属性 过滤器 | 更新日期: 2023-09-27 18:28:12

向操作添加诸如OutputCacheAttribute之类的筛选器属性并覆盖控制器的OnActionExecuting方法时,哪个先运行?任何地方都有完整MVC生活方式的文档吗?

过滤器属性的运行顺序

退房http://bradwilson.typepad.com/blog/2010/07/service-location-pt4-filters.html

总之:动作前过滤器(OnActionExecutingOnAuthorization等)自上而下运行,而动作后过滤器(OnActionExecutedOnResultExecuting等)自下而上运行。