Copied to clipboard

Flag this post as spam?

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


  • Carl Sjöholm 44 posts 327 karma points
    Aug 08, 2019 @ 07:07
    Carl Sjöholm
    0

    ContentFinderByRedirectUrl disappears when inserting or adding a custom ContentFinder

    Hi, I noticed something strange. After installing 301 Simple redirect package the 'ContentFinderByRedirectUrl' disappears from the collection of ContentFinders.

    protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
    {
       if (!ContentFinderResolver.Current.ContainsType(typeof(RedirectContentFinder)))
       {
           ContentFinderResolver.Current.InsertTypeBefore<ContentFinderByNotFoundHandlers, RedirectContentFinder>();
       }
    }
    

    Result when printing all contentfinders to logfile.

    ContentFinderByPageIdQuery at index 0

    ContentFinderByNiceUrl at index 1

    ContentFinderByIdPath at index 2

    RedirectContentFinder at index 3

    ContentFinderByNotFoundHandlers at index 4

    If I try to re-register the 'ContentFinderByRedirectUrl' I get an exception it's already registered.

    ContentFinderResolver.Current.InsertTypeBefore<ContentFinderByNotFoundHandlers, ContentFinderByRedirectUrl>();
    

    It doesn't matter if I add to the list or insert. There seem to be a limit of 5 ContentFinders?

    Anyone have an lead on this?

    PS. The UrlTracker stops working if 'ContentFinderByRedirectUrl' is not on that list. Even if it's "registered". This is the original issue I'm trying to solve.

  • Carl Sjöholm 44 posts 327 karma points
    Aug 08, 2019 @ 07:30
    Carl Sjöholm
    0

    If you look at the WebBootManager (disassembled)..

    ResolverBase<ContentFinderResolver>.Current = new ContentFinderResolver(this.ServiceProvider, ResolverBase<LoggerResolver>.Current.Logger, new Type[5]
      {
        typeof (ContentFinderByPageIdQuery),
        typeof (ContentFinderByNiceUrl),
        typeof (ContentFinderByIdPath),
        typeof (ContentFinderByRedirectUrl),
        typeof (ContentFinderByNotFoundHandlers)
      });
    

    So it would seem so. Any other solutions to finding content that is not a last chance contentfinder.

  • Carl Sjöholm 44 posts 327 karma points
    Aug 08, 2019 @ 07:59
    Carl Sjöholm
    0

    Just realized that I could add it to 404handlers.config. And hopefully fix this issue.

  • Carl Sjöholm 44 posts 327 karma points
    Aug 08, 2019 @ 08:09
    Carl Sjöholm
    0

    Ok.. Removed the application starting that registered the extra ContentFinder.

    ContentFinderByPageIdQuery at index 0

    ContentFinderByNiceUrl at index 1

    ContentFinderByIdPath at index 2

    ContentFinderByNotFoundHandlers at index 3

    --

    ContentFinderByRedirectUrl is still missing.

    Tried added it to 404handlers.config and it still doesn't work.

  • Carl Sjöholm 44 posts 327 karma points
    Aug 08, 2019 @ 08:17
    Carl Sjöholm
    0

    2019-08-08 10:11:47,450 [P4088/D86/T54] DEBUG Umbraco.Web.Routing.NotFoundHandlerHelper - Configured: 'umbraco.ContentFinderByRedirectUrl,umbraco'.

    2019-08-08 10:11:47,451 [P4088/D86/T54] DEBUG Umbraco.Web.Routing.NotFoundHandlerHelper - Configured: 'Simple301.RedirectContentFinder,Simple301'.

    2019-08-08 10:11:47,451 [P4088/D86/T54] DEBUG Umbraco.Web.Routing.NotFoundHandlerHelper - Configured: 'umbraco.SearchForAlias,umbraco'.

    2019-08-08 10:11:47,451 [P4088/D86/T54] DEBUG Umbraco.Web.Routing.NotFoundHandlerHelper - Registering 'umbraco.SearchForAlias'.

    2019-08-08 10:11:47,451 [P4088/D86/T54] DEBUG Umbraco.Web.Routing.NotFoundHandlerHelper - Configured: 'umbraco.SearchForTemplate,umbraco'.

    2019-08-08 10:11:47,452 [P4088/D86/T54] DEBUG Umbraco.Web.Routing.NotFoundHandlerHelper - Registering 'umbraco.SearchForTemplate'.

    2019-08-08 10:11:47,452 [P4088/D86/T54] DEBUG Umbraco.Web.Routing.NotFoundHandlerHelper - Configured: 'umbraco.SearchForProfile,umbraco'.

    2019-08-08 10:11:47,452 [P4088/D86/T54] DEBUG Umbraco.Web.Routing.NotFoundHandlerHelper - Registering 'umbraco.SearchForProfile'.

    2019-08-08 10:11:47,452 [P4088/D86/T54] DEBUG Umbraco.Web.Routing.NotFoundHandlerHelper - Configured: 'umbraco.handle404,umbraco'.

    2019-08-08 10:11:47,453 [P4088/D86/T54] DEBUG Umbraco.Web.Routing.NotFoundHandlerHelper - Registering 'umbraco.handle404'.

    It doesn't register 'ContentFinderByRedirectUrl' or 'RedirectContentFinder' however 'RedirectContentFinder' seem to work fine

  • Carl Sjöholm 44 posts 327 karma points
    Aug 08, 2019 @ 08:20
    Carl Sjöholm
    0

    Or is it that the "RedirectContentFinder" is still registered in some way or form...

    How can you restore the ContentFinders to default? Is there a database entry?

  • Carl Sjöholm 44 posts 327 karma points
    Aug 08, 2019 @ 08:36
    Carl Sjöholm
    100
    var contentFinders = new[]
            {
                typeof(ContentFinderByPageIdQuery),
                typeof(ContentFinderByNiceUrl),
                typeof(ContentFinderByIdPath),
                typeof(ContentFinderByRedirectUrl),
                typeof(ContentFinderByNotFoundHandlers)
            };
    
            foreach (var type in contentFinders)
            {
                ContentFinderResolver.Current.RemoveType(type);
    
                ContentFinderResolver.Current.AddType(type);
            }
    
Please Sign in or register to post replies

Write your reply to:

Draft