問題:
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,如何註冊過濾器?