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.
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.
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.
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));
Thanks, that worked!
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..
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?
var contentReference = UrlResolver.Current.Route(new UrlBuilder(context.RequestUrl.LocalPath)).ContentLink;