I'm using "Route Hijacking" for a specific document type and that is good.
However I wanted multiple document types that are using the same template to also execute the same controller.
I see from the documentation that I have the options to define a controller action for a specific template for a specific document type. Is there a way to attach a controller to a specified template for any document type?
I see I can have a controller for any document type and any template as the final third action. But is there any way that it is possible to route any of the document types that already have controllers to their defined controller if one exists after being intercepted by my "catch all" one?
then your replacement controller should inherit from umbraco's RenderMvcController class.
public class MySuperGlobalController : Umbraco.Web.Mvc.RenderMvcController
if you do this, then calling base.Index(Model) from within your Index method will fall through to the controller finding logic in Umbraco and any other controllers (such as your doctype specific ones) will be fired too after your catch all one has ran.
so something like this ?
public class MySuperGlobalController : Umbraco.Web.Mvc.RenderMvcController
{
public override ActionResult Index(RenderModel model)
{
// do the global stuff you need to here.
return base.Index(model);
}
}
Hijack Routing a Specific Template
I'm using "Route Hijacking" for a specific document type and that is good. However I wanted multiple document types that are using the same template to also execute the same controller.
I see from the documentation that I have the options to define a controller action for a specific template for a specific document type. Is there a way to attach a controller to a specified template for any document type?
I see I can have a controller for any document type and any template as the final third action. But is there any way that it is possible to route any of the document types that already have controllers to their defined controller if one exists after being intercepted by my "catch all" one?
HI
if you are replacing the default Controller for all doctypes and templates using
then your replacement controller should inherit from umbraco's
RenderMvcController
class.if you do this, then calling base.Index(Model) from within your Index method will fall through to the controller finding logic in Umbraco and any other controllers (such as your doctype specific ones) will be fired too after your catch all one has ran.
so something like this ?
Thanks Kevin - that's very clear thank you :)
is working on a reply...