I need to execute some custom code before IControllerFactory.GetControllerInstance() is called.
I have looked at using HtppApplication.BeginRequest event, but that would execute my code for every request made to the server (include requests for static resources) – not ideal.
Is there an extensibility point in MVC that I can use to achieve this?
I cannot think why you need to do this, however, I think the simplest would be to create your own
IControllerFactory. In MVC3, there is also new interfaceIControllerActivator.Here is an example using Unity,
and somewhere in your startup/boot strapping process,