November Happy Hour will be moved to Thursday December 5th.

How to get the correct link from LinkItem.Href.

Vote:
 

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

~/link/ca38f5e6e7a644e596a605e9e7e3d871.aspx

But i want it to be like this:

/Extranat/Idmanualer/Bil/Alfa-Romeo/

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. 

#173054
Dec 13, 2016 15:54
Vote:
 

Use LinkItem.Href.GetFriendlyUrl()

#282056
Jun 18, 2022 18:56
Vote:
 

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);
#282146
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.