Try our conversational search powered by Generative AI!

Can I render just the url from Url Property?


I want to just get a hold of the url from a Url property. How can I do this without it looking like this: /link/6d17f8c20ee240c8b3b8aaa0bfc7401a.aspx?id=5&epslanguage=sv ?

Jan 28, 2014 15:40
string result = string.Empty;
ServiceLocator.Current.GetInstance<IPermanentLinkMapper>().TryToMapped(url, out result);


Jan 28, 2014 20:36

You should be able to use ServiceLocator.Current.GetInstance<EPiServer.Web.Routing.UrlResolver().GetUrl(string internalUrl). UrlResolver also has a static property Current if you prefer that. 

In MVC views another option is to use the extension method ContentUrl for UrlHelper (resides in namespace EPiServer.Web.Mvc.Html)

Jan 29, 2014 10:01
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.