Copied to clipboard

Flag this post as spam?

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


  • Woodro 1 post 71 karma points
    Aug 02, 2021 @ 06:24
    Woodro
    0

    I can't seem to return any IPublishedContent.

    I wrote a search page and I am getting back results. I am getting back a content page with the id of 5105 and if I go through the admin console I can see the page with the id of 5105. But for some reason I cannot get this page (or any other page by id). In cshtml I tried using

    @(Umbraco.Content(5105))
    

    And Nothing, null value is what I get.

    My search service injects both UmbracoContextAccessor and UmbracoContextFactory and I leveraged EnsureContext within a using statement, same result, value is null.

    When I try to get a page manually in a controller I also get null back when using

    UmbracoContext.Content.GetById
    

    What am I missing? This is driving me insane.

    Thanks all

  • 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