Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
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.
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 ?
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:
EPiServer.Web.Routing.UrlResolver.Current.GetPermanent();
or
EPiServer.Web.Routing.UrlResolver.Current.TryToPermanent();
to get a permanent link
we have used
and
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" ?