Copied to clipboard

Flag this post as spam?

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


  • Thomas Park 3 posts 73 karma points
    Nov 06, 2017 @ 13:41
    Thomas Park
    0

    URL with KB number in load page

    Hi Guys,

    Is there a way for me to have a user go to a url e.g domain.com/Support/kb123 and bravo load the page. If so are there any examples I could follow?

  • Marc Goodson 617 posts 3810 karma points MVP 3x c-trib
    Nov 08, 2017 @ 21:38
    Marc Goodson
    0

    Hi Thomas

    When a request comes into Umbraco it executes a series of classes in it's incoming pipeline that all implement an IContentFinder interface.

    Each step in the queue of IContentFinders tries to find Content in Umbraco by different rules specified in each finder, if a finder does not find content, the next contentfinder in the queue has a go, and so on, until the 404 page is finally reluctantly shown.

    The ContentFinders that ship with Umbraco try to find content by url etc as you would expect the cms to work but...

    You can create your own IContentFinder that tries to find content based on the Url following your own finding logic, and register your IContentFinder in the queue by using the ContentFinderResolver class on application start.

    There is some documentation here:

    https://our.umbraco.org/documentation/reference/routing/request-pipeline/icontentfinder

    The gist would be to create a c# class in your umbraco project called something like KBNumberContentFinder, and have it inherit IContentFinder, you'll need to implement a single method called TryFindContent which will have passed to it the details of the request url.

    You can then read the KB number from the url, and search Umbraco for a page that has the particular KB number property, and if one is found, set that item as the found content, and return true!

    if that makes sense

    regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft