Where to intercept resolution of controller/view in ASP.Net MVC for customizations?

Posted by Jason Jackson on Stack Overflow See other posts from Stack Overflow or by Jason Jackson
Published on 2010-06-11T19:56:53Z Indexed on 2010/06/11 20:03 UTC
Read the original article Hit count: 217

Filed under:
|

I am trying to figure out where the appropriate place is to intercept the resolution of what view + controller is being called in ASP.Net MVC 2. I have a situation where I have a controller and a corresponding set of views. I also have the possibility of a customized version of both the controller and N of the views sitting in the project (or we may use something like Portable Views from the MvcContrib project). If the customized version of the controller or view(s) exists at run time, and the user satisfies certain criteria, I need to call the customized controller and use the appropriate customized view. At design/compile time we don't know what customizations may be in place.

My first run at this was by using a custom controller factory that returns a custom controller if it exists. However, this controller is "wired up" to the standard view, and I cannot figure out how to return the customized view if it also exists.

To complicate matters, there may be no customized controller but customized views, and visa-versa.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mvc