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

前端 未结 2 1703
广开言路
广开言路 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
    0 讨论(0)
  • 2021-02-07 00:02

    System.Web.Mvc.ActionFilterAttribute is intended for use with ASP.NET MVC. System.Web.Http.Filters.ActionFilterAttribute is intended for use with ASP.NET Web API.

    MVC is web applications, Web API is HTTP services.

    Their msdn pages are System.Web.Mvc.ActionFilterAttribute and System.Web.Http.Filters.ActionFilterAttribute

    0 讨论(0)
提交回复
热议问题