Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • MickTemp 27 posts 109 karma points
    Feb 27, 2019 @ 05:54

    Routing to custom controllers

    Hi all,

    I'm trying to lock down the best practise when it comes to setting up a custom controller and routes and rendering views that are completely outside of Umbraco and its content.

    Basically this part of the application isn't based off any content nodes, or at the very most based off a single "dashboard" node that has subpages that don't need to exist in Umbraco.

    The simplest example in the docs[1] would be to use UmbracoVirtualNodeByIdRouteHandler to provide the ID of this 'dashboard' node, but could I use this real node for every single route I'm making?

    If that won't work, would I need to create my own implementation of UmbracoVirtualNodeRouteHandler that yields 'fake' IPublishedContent instances per route? I suspect that is what the custom routes docs[2] are saying but I'm unsure without a solid example to look at.

    Would appreciate if anyone had any examples or input.



  • MickTemp 27 posts 109 karma points
    Feb 28, 2019 @ 01:19

    So without testing (yet), it seems something like the accepted answer here is the way to go:

    This was surprisingly unintuitive without an example to work with, though maybe its just me.

  • Lotte Pitcher 49 posts 242 karma points MVP 7x c-trib
    Feb 28, 2019 @ 12:47
    Lotte Pitcher


    Have you considered setting up a new Area (as in a 'MVC area': right click on your project > Add > Area...) for your custom controllers and views? If they really are outside of the Umbraco context then it should be just plain MVC for you whilst in that area. The routing that gets set up by MVC when you create the area should work without needing to configure anything in Umbraco, as far as I can remember from when I last did this.


Please Sign in or register to post replies

Write your reply to: