如何添加全球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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章