I'm probably getting rusty (...or I'm just in need of a X-Mas holiday break...) since I'm asking this question but here goes.
If I have a property on a block type that is of type EPiServer.Url, how do I resolve it? Or parse it to a friendly URL?
UrlResolver can take care of EPiServer.Core.ContentReference but I've forgotten if there's anything similar for EPiServer.Url.
We're running EPiServer CMS 10.10.4.0.
We use the following method for this scenario:
public static string FriendlyUrlFromUrl(string linkUrl)
var url = new UrlBuilder(linkUrl);
Global.UrlRewriteProvider.ConvertToExternal(url, null, Encoding.UTF8);
return url.Uri.IsAbsoluteUri ? url.Uri.AbsoluteUri : url.Uri.OriginalString;
I usually use the System.Web.Mvc.UrlHelper.ContentUrl which takes a Url property and returns the correct url going through the UrlResolver internally. It's part of Episerver's EPiServer.Web.Mvc.Html namespace