Copied to clipboard

Flag this post as spam?

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


  • MK 429 posts 906 karma points
    Apr 03, 2013 @ 09:07
    MK
    0

    uMapper - Node hostname

    Hi there,

    Is there away to know to which hostname the node I get is belong to?

    My website is multilanguage so I get a list of nodes as the required node is under each site.

    Regards,

    mkariti

     

  • MK 429 posts 906 karma points
    Apr 03, 2013 @ 09:50
    MK
    0

    Ok I managed to do this:

      public string HostName

            {

                get 

                {

                    var domains = umbraco.library.GetCurrentDomains(this.Id);

                    return domains[0].Name;

                }

            

            }

    Is there any other way to get the hostname per node?

    Cheers

    mkariti

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 03, 2013 @ 11:30
    Lee Kelleher
    100

    Hi mkariti,

    There's an extension method in uQuery (just include a "using umbraco;") called "GetFullNiceUrl" which can return the absolute URL for a node, but it does require a language (culture code) to be passed-through.

    Otherwise your example is the way to do it.

    Cheers, Lee.

  • MK 429 posts 906 karma points
    Apr 03, 2013 @ 11:31
    MK
    0

    Thanks Lee!

Please Sign in or register to post replies

Write your reply to:

Draft