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 826 posts 1269 karma points c-trib
    Oct 09, 2014 @ 14:12
    Martin Griffiths
    0

    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?

    Thanks

    Martin

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Oct 09, 2014 @ 14:19
    Shannon Deminick
    0

    Hi,

    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: https://github.com/Shandem/Articulate

    Here's the commits regarding what I've done: * https://github.com/Shandem/Articulate/commit/6b7f931c400b3ee963bb290cb75f6c4bc894a251 * https://github.com/Shandem/Articulate/commit/e3cfae9b2f25eddb3903fede805cc6d78abe0ede * https://github.com/Shandem/Articulate/commit/efdbdd01da5dab032db5d385b5c518879433cc66 * https://github.com/Shandem/Articulate/commit/2a593c93c5aaf1e330ef7e877ba0d2e1d6726624

    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 :

    /blog/articles

    but this needs to work for domains assigned such as:

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

    /root/some/sub/node/blog

    Let me know how you go

Please Sign in or register to post replies

Write your reply to:

Draft