Copied to clipboard

Flag this post as spam?

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


  • Lewis Smith 208 posts 617 karma points c-trib
    Aug 16, 2019 @ 10:16
    Lewis Smith
    0

    Hi All,

    I'm new to Umbraco 8 so trying to get my head around a few things, one of which is how to get the URL by its IContent.

    I'm in a service that doesn't inherit any Umbraco content so I'm using dependency injection to get the ContentService / EntityService etc.

    Currently, when I look at the node I have as IContent it doesn't have any URL associated with it, I'm assuming because Umbraco is fairly multilingual now. How do I get the URL for a given page?

    FYI, I don't have access to Umbraco.Content or I would do it that way!

    Any help!?

    Running Umbraco 8.1.2

  • Marcio Goularte 374 posts 1346 karma points
    Aug 17, 2019 @ 00:20
    Marcio Goularte
    0

    hi,

    Url is part of a published content. I do today like this:

    //only published content have Url Current.UmbracoContext.UrlProvider.GetUrl (content.Id)

    I have read here that it is not recommended to use Current this way, but I found no other way. Maybe injecting IUrlProvider

Please Sign in or register to post replies

Write your reply to:

Draft