问题:
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,如何注册过滤器?