Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

Can I render just the url from Url Property?

Vote:
 

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 ?

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

    

#80660
Jan 28, 2014 20:36
Vote:
 

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)

#80670
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.