How to get the friendly URL of a page in EPiServer CMS
This post explains how to get the friendly URL of a page in EPiServer, handy for those cases where you won't get automatic rewriting of internal URLs.
Maybe there are other posts about this, but I thought I'd share an easy way of getting the friendly URL of a page since I've gotten questions about it on numerous occasions:
public static string GetFriendlyURL(PageReference PageLink, string URL)
{
var url = new UrlBuilder(URL);
EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, PageLink, System.Text.UTF8Encoding.UTF8);
return url.Uri.AbsoluteUri;
}