ASP. net mvc contains the following four different types of action filters:
| Type |
Time to use |
Interface |
Implementation Method |
| Authorization Filter) |
Executed before any filter or action is executed for identity authentication. |
Iauthorizationfilter |
Authorizeattribute |
| Action Filter) |
Before or after an action is executed, when the action to be executed needs to generate records or cache data |
Iacationfilter |
Actionfilterattribute |
| Result Filter) |
It is executed before or after any actionresult is executed. You can execute some logic operations or modify the output result of viewresult before the view is displayed in the browser. |
Iresultfilter |
Actionfilterattribute |
| Exception Filter) |
It is executed before or after the action is executed, or before or after the result is executed. When an exception occurs during execution, you can use this filter to point to other pages to display the error message. |
Iexceptionfilter |
Iexceptionfilter |
The execution sequence of these four different types of action filters:
Validateinput attributes
[Httppost, validateinput (False)]PublicActionresult edit (IntID, formcollection formvalues ){ReturnView ();}