Try our conversational search powered by Generative AI!

Get pageReference from external URL



I have some links that I need to resolve to pageReferences, the PermanentLinkUtility.GetContentReference seems like the ideal solution but does not work.

The way I've implemented it is as follows

var site = "";
var url = new UrlBuilder(site);
var a = PermanentLinkUtility.GetContentReference(url);

This doesn't work at all in an EPi 7 MVC site.

Any advice where to start?

Dec 05, 2013 17:46

In EPiServer 7.5 you can use:

string url = "";

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

Dec 06, 2013 8:25

That should basically apply to CMS 7 as well, but then there is no static Current property on UrlResolver, instead you should get the instance from IOC/ServiceLocator.Currrent

Dec 06, 2013 9:10
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.