I am sure this has been addressed, but I cannot find the answers. I have a custom URL provider that inherits from the DefaultUrlProvider. I’m on v16.1.1.
Whenever I use the base.GetUrl(…) method, as in the docs, I always get an “unhandled exception,” and the site crashes.
Does anyone have suggestions or a fix for this?
EssCee
(SC)
September 27, 2025, 4:16am
2
Not entirely sure if this addresses your issue as I don’t see the code you have, but you could see if the below helps
public class MyCustomUrlProvider : DefaultUrlProvider
{
public MyCustomUrlProvider(IRequestAccessor requestAccessor, IOptions options)
: base(requestAccessor, options)
{
}
public override UrlInfo? GetUrl(IPublishedContent content, UrlMode mode, string? culture, Uri current)
{
if (content.ContentType.Alias != "myCustomType")
{
// Don't call base.GetUrl — just return null
return null;
}
// Your custom logic
var customUrl = $"/custom/{content.Name.ToLowerInvariant()}";
return new UrlInfo(customUrl, true, culture);
}
}`
If not, might be worth posting your code.
kevinm
(Kevin)
November 12, 2025, 2:43pm
3
@EricEngle-design did you ever figure anything out with this?
I’m seeing the same problem when trying override the DefaultUrlProvider, like shown at Outbound request pipeline | Umbraco CMS