SaaS CMS has officially launched! Learn more now.

Problem getting ContentReference from url in CMS 8

Vote:
 

Anyone else having problem with getting ContentReference from url with PermanentLinkUtility.GetContentReference in CMS 8? Worked before the upgrade. We're trying to fetch the ContentReference of content in a LinkItemCollection.

#117930
Feb 24, 2015 14:40
Vote:
 

Hi,

This might be related to the removal of "mapped/classical" links. Please see the breaking changes here, http://world.episerver.com/documentation/Items/Upgrading/EPiServer-CMS/8/Breaking-changes/, under the 'PageData.LinkURL and classic links' section.

#117938
Feb 24, 2015 18:14
Vote:
 

Hi,

Yes, I have looked at that. But as I understand it, it's just classical links that has been removed? My link is in Permanent links format e.g ~/link/bbaadfc8-44d8-42a6-b559-b20f08714084.aspx. I have compared the link from a 7.19.2 version of our site and the link looks exactly the same and I am able to get a ContentReference out from the link using PermanentLinkUtility.GetContentReference in that version.

#117941
Feb 24, 2015 20:31
Vote:
 

We have also encountered this problem today, a workaround is to resolve the ContentReference with the UrlResolver

var contentReference = UrlResolver.Current.Route(new UrlBuilder(permanentLink));

#117952
Edited, Feb 25, 2015 9:46
Vote:
 

Thanks, that worked!

#117954
Feb 25, 2015 10:27
Vote:
 

Nice catch, that method only supports classic links and should probably be obsoleted. I will report a bug so that we can have a look..

#117978
Feb 25, 2015 11:40
Vote:
 

There are more functions related to mapped url's, e.g. PermanentLinkMapStore.TryToMapped(); are these going to be obsoleted as well, or do they still work?

#118363
Mar 05, 2015 5:55
Vote:
 

Thanks 

var contentReference = UrlResolver.Current.Route(new UrlBuilder(context.RequestUrl.LocalPath)).ContentLink; 

is working

.. :)

#179660
Jun 19, 2017 12:32
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.