Create one class that implements IActionFilter and / or IResultFilter:
public class FilterAllActions : IActionFilter, IResultFilter
{
public void OnActionExecuting(ActionExecutingContext filterContext)
{
throw new System.NotImplementedException();
}
public void OnActionExecuted(ActionExecutedContext filterContext)
{
throw new System.NotImplementedException();
}
public void OnResultExecuting(ResultExecutingContext filterContext)
{
throw new System.NotImplementedException();
}
public void OnResultExecuted(ResultExecutedContext filterContext)
{
throw new System.NotImplementedException();
}
}
And register it on Global.asax
protected void Application_Start()
{
RegisterGlobalFilters(GlobalFilters.Filters);
}
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new FilterAllActions());
}
source
share