Looking forward for a suggestion for a below problem. Thanks!
I wanted to setup DefaultController in Umbraco v9 so that I donot need to create Controller for each DocumentType because we pass the ContentModel inside the mastermodel
We created DefaultController and added override IActionResult Index
But this code always show action as "Index".
string template = ControllerContext.RouteData.Values["action"].ToString();
In previous version, this action was name of the template. We wanted to get the name of the template when calling CurrentTemplate function.
Thanks - This works fine if I access from RenderControler but when I switch to IRenderControler then I am not getting access to CurrentTemplate. Any idea how can we use the CurrentTemplate function for IRenderControler.
How to setup DefaultController in v9?
Looking forward for a suggestion for a below problem. Thanks!
I wanted to setup DefaultController in Umbraco v9 so that I donot need to create Controller for each DocumentType because we pass the ContentModel inside the mastermodel
We created DefaultController and added override IActionResult Index
But this code always show action as "Index". string template = ControllerContext.RouteData.Values["action"].ToString();
In previous version, this action was name of the template. We wanted to get the name of the template when calling CurrentTemplate function.
Hi,
I am not sure what you are trying to do. But this code works for me with a default controller.
public class DefaultRenderController : RenderController {
public DefaultRenderController(ILogger
}
This will render the default template for the doctype
Thanks - This works fine if I access from RenderControler but when I switch to IRenderControler then I am not getting access to CurrentTemplate. Any idea how can we use the CurrentTemplate function for IRenderControler.
Hi Shaishav,
A route hijacked controller or a default controller should inherit from RenderController.
Dave
is working on a reply...