How to translate an internal url to external url

  • Updated
Description

Clients will sometimes acquire links from the database in a format resembling: ~/link/123456789.aspx

 

Steps

In order to programmatically translate such a url, one would use the following code snippet, passing in the '~/link...' url as "url" in this example: 

string formattedUrl = ServiceLocator.Current.GetInstance<UrlResolver>().GetUrl(url);