I've created a webapi filter (it's using Microsoft.AspNet.WebApi.Core):
using System.Web.Http.Filters;
...
public class AuthenticationFilter : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext actionContext)
.... }
and use it in my controller:
[AuthenticationFilter]
public class MyController : SomeBaseController
than i'm adding into the bootstrpper using:
_httpConfiguration.Filters.Add(new AuthenticationFilter());
the problem is that OnActionExecuting doesn't firing.
can u assist?
It is not gonna fire if you dont add it to the services
services.AddMvc(options =>
{
options.Filters.Add(typeof(SampleActionFilter));
});
I suggest to check out this link as well
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.