In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what is the order in which ASP.NET MVC filters are executed. I hope you will get something after reading this article. Let's discuss it together.
Rule 1: different types of filters have a sequence
That is, the order of execution is: authorization filter-> Action filter-> result filter-> exception filter.
Note: if an exception occurs during the execution of the ActionFilter filter, the ExceptionFilter filter is executed, not the ResultFilter filter. The above figure shows the order of execution under normal circumstances.
Rule 2: the filter on the controller takes precedence over the filter on the method
That is, the same filter is used on both the controller and the method, so the filter above the controller is executed first. As shown in the following figure:
Rule 3. The Order attribute can determine the order of filters.
The default order=-1, that is, a filter with no order set will be executed first. As shown in the following figure:
Rule 4. If the type of filter is the same, the filter with the same order cannot determine who will execute it first.
As shown in the following figure:
Rule 5. The filter interface method implemented by the controller takes priority.
The OnActionExecuting method of the ActionFilter filter is implemented in the figure above, so execute this method first before executing ActionFilter1. As shown in the following figure:
After reading this article, I believe you have a certain understanding of "what is the execution order of ASP.NET MVC filter". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.