Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Episerver 8 UrlResolver issue


Hi, How would you update our 7.5 code which is:

public string UrlToPage(PageReference pageLink)
return new UrlResolver().GetUrl(pageLink, ContentLanguage.PreferredCulture.Name);

To work in Episerver 8 as UrlResolver is now abstract?

Mar 11, 2015 16:55

How about the following:

var urlResolver = ServiceLocator.Current.GetInstance<UrlResolver>();
var url = urlResolver.GetUrl(pageLink, ContentLanguage.PreferredCulture.Name);


Mar 11, 2015 17:11

Without any furtuer investigation I have used your second aproach since version 7 was released.

Mar 11, 2015 20:15
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.