Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
If you get the IPageRouteHelper service it has a property called ContentLink which is the current page's PageReference. You can then pass this is to the IUrlResolver GetUrl method
Thanks! Yeah, ended up with this.
public static PageData CurrentPage =>
ServiceLocator.Current.GetInstance<IPageRouteHelper>().Page;
public static string CurrentPageUrl => UrlResolver.Value.GetUrl(CurrentPage);
Hello,
I am trying to figure out how to use IPageRouteHelper to get the current url a block is on. I was directed to the page below for PageLink, but the Example section is empty. Does anyone have an example handy?
https://world.episerver.com/documentation/class-library/?documentId=cms/10/7D323675