How to get the correct link from LinkItem.Href.


How can i get the actual link from LinkItem.Href? The Href looks something like this:


But i want it to be like this:


If i use @Html.PageLink i get the correct url like above. But it creates an <a> tag with the title from the LinkItem that is clickable with the right url. I only want it to output the url. 

Dec 13, 2016 15:54

Use LinkItem.Href.GetFriendlyUrl()

Jun 18, 2022 18:56

To resolve an internally formatted URL like that into a friendly URL, you can get an instance of UrlResolver (from EPiServer.Web.Routing) and call GetUrl() like this:

var friendlyUrl = EPiServer.Web.Routing.UrlResolver.Current.GetUrl(myLinkItem.Href);
Jun 20, 2022 19:02
* 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.