I am building an MVC4 application, where I have the normal MVC views and I have added a few WebAPI controllers. I know that the corresponding controllers exist in different namespaces (System.Web.Mvc and System.Web.Http).
So, I want to create a custom controller which will capture all incoming calls (to webpages and to WebAPI), register the call and perform authorisation, all in one class for consistency.
Is there a MVC way to do that? If this cannot be done with 1 custom controller, is there any other approach to this? Would a HttpModule be a good idea for an MVC application?
Right now, I have created 2 similar classes which derive from: System.Web.Http.ApiController and System.Web.Mvc.Controller but does not seem like a good idea, as I almost duplicate the code.