Copied to clipboard

Flag this post as spam?

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


  • Paul Seal 428 posts 2354 karma points MVP 3x c-trib
    Jul 15, 2020 @ 15:29
    Paul Seal
    0

    Handling .html urls with a ContentFinder

    Hi all

    In Umbraco v8, I am trying to get a content finder to work for .html pages.

    Currently the content finder only fires if the url doesn't end in .html

    Does anyone know how I can get Umbraco to see .html urls as umbraco requests please so I can handle them with a content finder.

    Kind regards

    Paul

  • AbsolutelyN 38 posts 267 karma points
    Jul 15, 2020 @ 15:39
    AbsolutelyN
    0

    I would have thought you'd need to add IIS handler mappings so that html files are picked up by Isapimodule?

  • Richard Hamilton 36 posts 158 karma points
    Jul 15, 2020 @ 15:43
    Richard Hamilton
    100

    Yep as Umbraco won't get the hit with calls to .html IIS will handle it and try to return a static file.

    Found this post which might be useful https://our.umbraco.com/forum/umbraco-7/developing-umbraco-7-packages/64607-Handling-static-file-extensions-to-find-content

  • Paul Seal 428 posts 2354 karma points MVP 3x c-trib
    Jul 15, 2020 @ 16:18
    Paul Seal
    0

    Ok so now I don't know how to get the Umbraco Context from within an HttpHandler.

    Current is null so I can't use that. Anyone got any ideas?

  • AbsolutelyN 38 posts 267 karma points
    Jul 15, 2020 @ 16:33
    AbsolutelyN
    0

    Haven't made a httpHandler in a long time but if I remember correctly they run before Umbraco so context may not be available. Might be a work around/hack though. Can you not do what you are doing with an IComponent?

  • Paul Seal 428 posts 2354 karma points MVP 3x c-trib
    Jul 15, 2020 @ 16:35
    Paul Seal
    0

    I got it working in the end thanks for all of your help.

    I used a combination of Barry's answer in the link Richard gave, and also this https://github.com/vegaitsourcing/patrija/blob/1475bc9fe312329c916ea11cfa286e7bc9c6a6d5/Patrija.Core/HttpHandlers/RobotsHandler.cs

    It now works how I need it to, although it's not pretty 😆

    Thanks again

    Paul

  • 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