Try our conversational search powered by Generative AI!

Episerver 8 UrlResolver issue

Vote:
 

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?
Jon

#118687
Mar 11, 2015 16:55
Vote:
 

How about the following:

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

??

#118689
Mar 11, 2015 17:11
Vote:
 

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

#118693
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.