PermanentLinkMapStore.TryToMapped and PermanentLinkUtility.GetContentReference not working after EPiServer 9 Upgrade


we have used

string linkUrl;
if(PermanentLinkMapStore.TryToMapped(url, out linkUrl)){


var contRef = PermanentLinkUtility.GetContentReference(url);

But those are now not supported in EPiServer 9. So What should I do to correct this ?
Can I use "PermanentLinkMapStore.ToPermanent" as alternative to "PermanentLinkMapStore.TryToMapped" ?

#140729 Oct 28, 2015 16:13
  • Member since: 2011

    What about UrlResolver?

    #140740 Oct 28, 2015 22:38
  • Member since: 2007

    As Valdis said. But I wanted to add that mapped URLs doesn't exist anymore, so your first code snippet doesn't make sense to handle in EPiServer 9 at all.

    #140741 Oct 28, 2015 23:55

    Yes Valdis, I figured it out that I can get ContentReference like:

    var content = UrlResolver.Current.Route(new UrlBuilder(url));
    if (content?.ContentLink != null)
    var contRef = content.ContentLink;

    But the problem is what would be the alternative for "PermanentLinkMapStore.ToPermanent" ?

    As per Johan, it is true that "PermanentLinkMapStore.ToPermanent" has no sense in EPiServer 9, but what would be the safest way to replace existing code ?

    #140751 Oct 29, 2015 10:21
  • Member since: 2007

    Permanent links still exist. Mapped URL doesn't, which your first code snippet was referring to. So what are you trying to achieve, to mapped or to permanent?

    You can try:




    to get a permanent link

    #140752 Oct 29, 2015 10:37

    Sorry Johan, what I referring was "PermanentLinkMapStore.TryToMapped" has no sense in EPiServer 9. 

    OK. So I'll try with "PermanentLinkMapStore.TryToPermanent".  Actually my intention is to get Permanent Link here

    #140757 Oct 29, 2015 11:22