I created an ASP .NET WebApi application that has a web service part which I wrote myself, and a web site part that came by default after creating the project and which provides a dynamically generated documentation for the web service part.
I created a whitelist of domain names and IP addresses allowed to access both the web service and web site parts of the application. For that purpose, I wrote an action filter responsible for returning an HTTP code 403 to non-whitelisted visitors.
Apparently, Mvc and WebAPI being two different frameworks, I cannot reuse my filter for both parts of my application, the one expecting a WebAPI action filter and the other excepting an Mvc action filter.
So my question is: is there a way to make a filter compatible with both, or will I end up being force to factor my code into some shared class and call if from two different action filter classes?