You'll need to implement IControllerFactory (or inherit from DefaultControllerFactory which contains some extra functionality). After that, set your controller factory in Application_Start
by using SetControllerFactory method:
ControllerBuilder.Current.SetControllerFactory(new MyControllerFactory());
Hope this clarifies things a bit for you.