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
We have an implementation of DefaultUrlProvider registered in our Umbraco 10.6.1 website. The problem we are facing is that the overridden GetUrl() method we have implemented only ever seems to get run when the application is started, or when any content is published. As a result, the previously overridden URL values are retrieved from the publishedValueFallback passed into the constructor, from when the application was last started or when any content was published.
public OurUrlProvider(IOurUrlProviderService ourUrlParserService, IOptionsMonitor<global::Umbraco.Cms.Core.Configuration.Models.RequestHandlerSettings> requestSettings, ILogger<DefaultUrlProvider> logger, ISiteDomainMapper siteDomainMapper, IUmbracoContextAccessor umbracoContextAccessor, UriUtility uriUtility, global::Umbraco.Cms.Core.Services.ILocalizationService localizationService) : base(requestSettings, logger, siteDomainMapper, umbracoContextAccessor, uriUtility, localizationService)
_ourUrlProviderService = ourUrlParserService;
public override UrlInfo GetUrl(IPublishedContent content, UrlMode mode, string culture, Uri current)
var baseUrl = base.GetUrl(content, mode, culture, current);
if (content == null)
// logic to append IDs to URLs in links is done in this DI'd service
var newUrl = _ourUrlProviderService.GetUrl(baseUrl);
Some snippets from one of the generated models that is affected by this issue (constructor, and one of the properties where we would expect the links to be overridden by the DefaultUrlProvider middleware:
Home.generated.cs (putting a breakpoint in this constructor and hitting the Home controller shows that the publishedValueFallback values are being used):
public Home(IPublishedContent content, IPublishedValueFallback publishedValueFallback)
: base(content, publishedValueFallback)
_publishedValueFallback = publishedValueFallback;
One of the properties that we would expect to be transformed by the DefaultUrlProvider (our OverrideableBlockListModel inherits from a collection of Umbraco's BlockListItem):
public virtual global::OurOrganisation.Umbraco.BlockLists.OverridableBlockListModel BlocksLinks
=> this.Value<global::OurOrganisation.Umbraco.BlockLists.OverridableBlockListModel>(_publishedValueFallback, "blocksLinks");
Is there any way to tell our models to not use the PublishedValueFallback? Or is there something missing in the setup of the DefaultUrlProvider middleware? Any help would be greatly appreciated!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted