Copied to clipboard

Flag this post as spam?

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

  • Martin Griffiths 804 posts 1215 karma points c-trib
    Oct 09, 2014 @ 14:12
    Martin Griffiths

    Getting a multisites rootnodeId from a custom route (controller/action)

    Hi all

    I'm working on a new project in Umbraco 7 that's multi-subdomain / multisite build.

    I have structured the site so that the root "/" sits at the top of the tree and all subsites sit below with each one having a sub-domain assigned to it.

    Now, I'm also registering some custom routes for the entire application ie the roots are available to every sub-site. These customs roots provide some application functionality that I dont want to be part of Umbraco, but I do want to continue to access each subsites root (home) to be able to use some important properties i've added to it and of course render all of the usual site menus and structure that are contained within the subsite.

    I was using this code on the actions on my controller for my custom pages to get the subsite root nodeId.

    siteRootNodeId = Domain.GetDomain(Request.Url.Authority).RootNodeId

    But it would appear that this only works on site roots "/" and seems to be returning null on any other subsite node under a custom route.

    I've looked at this new suggested attribute decoration to pass in my site root as a starting point but I have no idea where to go from there! Of course the one thing I do have is the hostname for the subsite, which is what I thought I could use as my hook, but it would seem not.

    Does anyone have any ideas how I would go about getting the subsite node id in custom routes?



  • Shannon Deminick 1522 posts 5242 karma points
    Oct 09, 2014 @ 14:19
    Shannon Deminick


    I'm not sure if it's exactly the issue you have but I have multi-tenancy working for Articulate with domains and custom routes.

    The code is here:

    Here's the commits regarding what I've done: * * * *

    It's late here now so that's about all the info I can give you till tomorrow. Have a look and see if that might help you out if you can make sense of it. Essentially I'm creating custom routes like :


    but this needs to work for domains assigned such as:

    even though those domains might actually be assigned in the tree like:


    Let me know how you go

Please Sign in or register to post replies

Write your reply to: