Copied to clipboard

Flag this post as spam?

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


  • Samin Shrestha 5 posts 75 karma points
    Jan 16, 2017 @ 16:52
    Samin Shrestha
    0

    NiceUrl returns absolute path once basemethod is called

    I have recently upgraded my umbraco from 4.7.1.1 to 4.11.10 where I have multiple sites with multiple hostnames defined for one site.

    • Site1 (test.com/dev , test.com/local , test.com/abc) [nodeId = 1]
      • testFolder [nodeId = 12]
        • test.aspx [nodeId = 123]
    • Site2 (test.com/dev1 , test.com/local1 , test.com/abc1) [nodeId = 2]
      • testFolder1 [nodeId = 21]
        • test1.aspx [nodeId = 213]

    I am on test.com/local site and when I call umbraco.library.NiceUrl(123) prior calling basemethod it returns a relative path i.e., (/testFolder/test.aspx) However, if I try to call the same logic [umbraco.library.NiceUrl(123)] from the same site [test.com/local] after I have called basemethod then I get absolute path (test.com/abc/testFolder/test.aspx).

    Can anybody please explain why I am getting absolute path with different domain. Is there a way to still find relative path once I call basemethod?

  • Samin Shrestha 5 posts 75 karma points
    Jan 16, 2017 @ 20:39
    Samin Shrestha
    0

    I also noticed that If I add [test.com] on managed hostname under site 1 then I will start receiving relative path on site 1. If I added on site 2 only then I will receive relative path on site 2. However, I cannot add same hostname in more than one location. Since I get absolute path from NiceUrl, it seems that it is pointing to different host name.

    For Instatnce, if I am on the Site 1 (test.com/local) and trying to access test.aspx (nodeID 123) it returns (test.com/abc/testFolder/test.aspx)

    Therefore, I am looking for relative paths from NiceUrl. Any suggestions please?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies