Copied to clipboard

Flag this post as spam?

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


  • John Churchley 259 posts 1155 karma points c-trib
    Feb 14, 2018 @ 12:48
    John Churchley
    0

    Hi,

    I'm trying to create a custom routes for a package dynamically in a ApplicationEventHandler. I'm trying to use existing node url to form the route. However when I use the Umbraco Helper

       var pageData  umbracoHelper.ContentQuery.TypedContent(page.Id); 
    

    pageData.Url returns the absolute I'm trying to get the relative url to the domain.

    I was thinking of an extension method which removes the host but wondered if there was a native method?

  • Alex Skrypnyk 4637 posts 16596 karma points MVP 2x admin
    Feb 14, 2018 @ 15:50
    Alex Skrypnyk
    0

    Hi John

    It looks like "useDomainPrefixes" is set to true in your solution.

    You can change it in /config/umbracoSettings.config

    /Alex

  • John Churchley 259 posts 1155 karma points c-trib
    Feb 14, 2018 @ 15:54
    John Churchley
    2

    Hi Alex,

    "useDomainPrefixes" is set to false thanks for the suggestion. I ended up using an exension method with the following code:

       Uri myUri = new Uri(pageData.Url());
       pageUrl = myUri.AbsolutePath.TrimStart("/");
    

    John

  • Alex Skrypnyk 4637 posts 16596 karma points MVP 2x admin
    Feb 16, 2018 @ 08:20
    Alex Skrypnyk
    0

    Hi John

    Thanks for sharing the solution, have a great day

    /Alex

Please Sign in or register to post replies

Write your reply to:

Draft