Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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:
I have removed pretty much all my custom code on the controller and view model and it's still failing.
Controller:
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); } }
View:
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<SearchResultsPageModel> <p>search</p>
Any ideas what I'm missing?
Hi Mario,
What does your SearchResultsPageModel definition look like?
Have you inherited from PublishedContentWrapped
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) { } }
is working on a reply...
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.
Continue discussion
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:
I have removed pretty much all my custom code on the controller and view model and it's still failing.
Controller:
View:
Any ideas what I'm missing?
Hi Mario,
What does your SearchResultsPageModel definition look like?
Have you inherited from PublishedContentWrapped
Ah yep, I forgot that one, here you go. Again, I have removed any custom properties and it's still failing.
is working on a reply...
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.