如何添加全球ASP.Net Web Api过滤器? - How to add global ASP.Net Web Api Filters?

问题:

I've created a Web Api filter (using System.Web.Http.Filters.ActionFilterAttribute ) but I am unable to get it to work inside of ASP.Net MVC 4. I tried adding it to the RegisterGlobalFilters() method but that didn't work. 我已经创建了一个Web Api过滤器(使用System.Web.Http.Filters.ActionFilterAttribute ),但是我无法让它在ASP.Net MVC 4中运行。我尝试将它添加到RegisterGlobalFilters()方法但是没有不行。

So if one is using Web Api hosted in ASP.Net MVC how does one register filters? 因此,如果使用ASP.Net MVC中托管的Web Api,如何注册过滤器?


解决方案:

参考: https://stackoom.com/en/question/dwrA
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章