Try our conversational search powered by Generative AI!

LinkCollection links are wrong


Has anyone ever seen the individual items in the LinkCollection get output with links like this:


I can't see how I'm doing anything oddly, but whenever I link to a page within EPiServer within a LinkCollection, that's the link that comes out.  I've debugged and gone all the back to just before I DataBind, and, indeed, this is the Href of the LinkItem objects in the LinkItemCollection.

Anyone seen this before?

Mar 16, 2010 14:16

You can't use the linkItem.href directly on internal links because it's in the internal permanentlink format.

If you want a link from each link item ute linkitem.ToMappedLink() or

Use PermanentLinkMapStore.TryToMapped if you want to create you're own links.



Mar 16, 2010 15:10

The following blog post should guide you on your way:

Mar 16, 2010 15:11

Yes - this is how EPiServer stores each link item in the database (as part of the PermanentLinkMapStore), if you inspect the LinkItem object you'll see that there ia a method called

.ToMappedLink() which will give you the mapped friendly url which I imagine is what you wish to render to the page.

You may also find this blog post handy Convert a LinkItemCollection to a list of PageData

Edited, Mar 16, 2010 15:27

Thanks, everyone.  I appreciate the help.

Mar 17, 2010 6:10

What I was looking for was the GetMappedHref() method.  This returns the correct link.


<a href="<%# ((EPiServer.SpecializedProperties.LinkItem)Container.DataItem).GetMappedHref() %> %>"><%# Eval("Text") %></a>

Mar 17, 2010 15:04

I'm having this problem in the edit mode on a CMS 5 site, after updating some pages programmatically. A few of the pages updated got their linkURL messed up, and displays links like the above. What causes this?

These pages have ~link/[guid].aspx style links in the edit tree as well as in page lists on the site.



Nov 18, 2010 9:27
* 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.