kenticokentico-mvckentico-12

Access Kentico 12 Alternative URL value


I'm looking for a way to retrieve the alternative URL value for a page in kentico.

Having followed this example to enable Alternative Urls in Kentico 12 SP : https://docs.kentico.com/k12sp/developing-websites/configuring-page-urls-on-mvc-sites/enabling-alternative-urls-for-pages

I'm now stuck trying to access the value for the alternative URL programmatically. Any pointers towards how I may get the value would be greatly appreciated.


Solution

  • Have you tried using AlternativeUrlInfoProvider class?

    You can do something like this is if you have the page:

       var altUrl = AlternativeUrlInfoProvider.GetAlternativeUrls()
                    .Where("AlternativeUrlDocumentID", QueryOperator.Equals, page.DocumentID).FirstOrDefault();