System.Web.Mvc.ActionFilterAttribute vs System.Web.Http.Filters.ActionFilterAttribute

前端 未结 2 1697
广开言路
广开言路 2021-02-06 23:33

i see that there are two version of ActionFilterAttribute class.
System.Web.Mvc.ActionFilterAttribute and System.Web.Http.Filters.ActionFilterAttri

2条回答
  •  野的像风
    2021-02-07 00:01

    The System.Web.Http one is for Web API; the System.Web.Mvc one is for previous MVC versions.

    You can see from the source that the Web API version has several differences.

    • It has OnResultExecuting and OnResultExecuted handlers ("Called by the ASP.NET MVC framework before/after the action result executes.")
    • It can be executed asynchronously
    • It does not let you specify an order of execution

提交回复
热议问题