Copied to clipboard

Flag this post as spam?

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

  • Mario Lopez 168 posts 952 karma points MVP 3x c-trib
    Jan 12, 2023 @ 05:24
    Mario Lopez

    Unable to hijack route. Error on ViewDataDictionary

    I don't know what I'm missing but I have a weird error coming up when I'm trying to hijack a route on Umbraco 10.3.2.

    I'm getting this error: enter image description here

    I have removed pretty much all my custom code on the controller and view model and it's still failing.


    public class SearchResultsController : RenderController
            private readonly ISearchService searchService;
            private readonly IPublishedContentQuery publishedContentQuery;
            private readonly IVariationContextAccessor variationContextAccessor;
            private readonly ServiceContext context;
            private readonly ILogger<SearchResultsController> logger;
            public SearchResultsController(ILogger<SearchResultsController> logger,
                                           ICompositeViewEngine compositeViewEngine,
                                           IUmbracoContextAccessor umbracoContextAccessor,                                       
                                           ISearchService searchService,
                                           IPublishedContentQuery publishedContentQuery,
                                           IVariationContextAccessor variationContextAccessor,
                                           ServiceContext context)
                : base(logger, compositeViewEngine, umbracoContextAccessor)
                this.searchService = searchService;
                this.publishedContentQuery = publishedContentQuery;
                this.variationContextAccessor = variationContextAccessor;
                this.context = context;          
                this.logger = logger;            
            public override IActionResult Index()
                if (CurrentPage is null) return NotFound();
                var pageModel = new SearchResultsPageModel(CurrentPage, new PublishedValueFallback(context, variationContextAccessor));
                return CurrentTemplate(pageModel);


    @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<SearchResultsPageModel>

    Any ideas what I'm missing?

  • Huw Reddick 1811 posts 6245 karma points MVP c-trib
    Jan 12, 2023 @ 09:37
    Huw Reddick

    Hi Mario,

    What does your SearchResultsPageModel definition look like?

    Have you inherited from PublishedContentWrapped

  • Mario Lopez 168 posts 952 karma points MVP 3x c-trib
    Jan 12, 2023 @ 10:07
    Mario Lopez

    Ah yep, I forgot that one, here you go. Again, I have removed any custom properties and it's still failing.

    public class SearchResultsPageModel : PublishedContentWrapped
        public SearchResultsPageModel(IPublishedContent content, IPublishedValueFallback publishedValueFallback)
            : base(content, publishedValueFallback) { }
Please Sign in or register to post replies

Write your reply to: