Copied to clipboard

Flag this post as spam?

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


  • Tom 6 posts 108 karma points
    Jul 10, 2020 @ 10:42
    Tom
    0

    Umbraco 8 IPublishedContentCache.GetByRoute ignores IContentFinder

    Hey Guys,

    I need to resolve content by URL, using the following works for pages that exist in Umbraco...

     string route = "abc/123"; // Existing page in Umbraco
     IPublishedContent content = UmbracoContext.Content.GetByRoute(route);
    

    however I am using custom routes and IContentFinders. The GetByRoute method seems to ignore any custom IContentFinders all together

     string route = "custom/dynamic/route"; // Existing page in Umbraco
     IPublishedContent content = UmbracoContext.Content.GetByRoute(route);
    
    // content is always null and IContentFinder not hit
    

    When making the request directly to umbraco for example: http://localhost/custom/dynamic/route My IContenFinder is hit and the content is resolved.

    Am I right in thinking what I am trying to do won't work as the GetByRoute method essentially goes to the cache and not through the umbraco request pipeline. If so, is there an alternative way to programmatically get content by URL or route?

    Thanks in advance

  • Anders Pedersen 1 post 71 karma points
    Dec 10, 2020 @ 11:40
    Anders Pedersen
    0

    I am also interested in a solution for this. Did you manage to find a solution?

Please Sign in or register to post replies

Write your reply to:

Draft