The following code, in my Global.asax, works for me:
public static void RegisterWebApiFilters(System.Web.Http.Filters.HttpFilterCollection filters)
{
filters.Add(new MyWebApiFilter());
}
protected void Application_Start()
{
RegisterWebApiFilters(GlobalConfiguration.Configuration.Filters);
}
More Related Contents:
- How to create ASP.NET Web API Url?
- WebApi Json.NET custom date handling
- Problems implementing ValidatingAntiForgeryToken attribute for Web API with MVC 4 RC
- How to pass json POST data to Web API method as an object?
- Pass data to layout that are common to all pages
- How do I set a cookie on HttpClient’s HttpRequestMessage
- Dot character ‘.’ in MVC Web API 2 for request such as api/people/STAFF.45287
- How to validate file type of HttpPostedFileBase attribute in Asp.Net MVC 4?
- How to add reference to System.Web.Optimization for MVC-3-converted-to-4 app
- Could not load file or assembly ‘System.Net.Http, Version=2.0.0.0 in MVC4 Web API
- Error :Request header field Content-Type is not allowed by Access-Control-Allow-Headers
- Anti forgery token is meant for user “” but the current user is “username”
- Redirect from asp.net web api post action
- ViewModels or ViewBag?
- How do I use my own database with SimpleMembership and WebSecurity? What is MVC4 security all about?
- ASP.NET MVC 4 Application Calling Remote WebAPI
- ASP.NET 4.5 has not been registered on the Web server
- ASP.NET Web API returns 404 for PUT only on some servers
- ASP.NET MVC 4 custom Authorize attribute – How to redirect unauthorized users to error page? [duplicate]
- The required anti-forgery form field “__RequestVerificationToken” is not present Error in user Registration
- Return Json, but it includes backward slashes “\”, which I don’t want
- MVC 4 Beta side by side installation error
- What’s the difference between WCF Web API and ASP.NET Web API
- MVC 4 date culture issue?
- How to add and get Header values in WebApi
- What effect does the new precompile during publishing option have on MVC4 applications?
- Web API in MVC solution in separate project
- ASP.NET MVC 4 Editor Template for basic types
- All requests to ASP.NET Web API return 404 error
- URL encoded colon resolves in 400 Bad Request