Friendly URL in code behind

Vote:
 

I can't seem to figure out how to print the friendly URL of a page in code behind. I need to be able to render it without adding it to the markup. Has anyone got a function that does this?

#52999
Aug 24, 2011 16:07
Vote:
 

Never mind, I found this one. :)

public string FriendlyURL(PageReference PageLink, string URL)
{
    var url = new UrlBuilder(URL);
    EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, PageLink, System.Text.UTF8Encoding.UTF8);
    return url.Uri.AbsoluteUri;
}

#53000
Edited, Aug 24, 2011 16:25
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.