How to get url of a page in multilanguage website?

Posted by Community Admin on 03-Aug-2018 13:53

How to get url of a page in multilanguage website?

All Replies

Posted by Community Admin on 11-Jan-2011 00:00

Hi,
I have a multilanguage website. In a custom widget I'm trying to get the home page url. There are two available languages: English and Spanish. The url of the home page is "http://mywebsite/home" for the english language and http://mywebsite/es/home_es for the Spanish.
Using the following code however gives me the wrong url:

PagesConfig pagesConfig = Config.Get<PagesConfig>();
PageManager pageManager = new PageManager();
PageNode page = pageManager.GetPageNode(pagesConfig.HomePageId);
string homePageUrl = page.GetFullUrl(Thread.CurrentThread.CurrentUICulture, false);

For English language it returns http://mywebsite/home which is correct, but for Spanish the url is wrong - http://mywebsite/es/home which leads to 404 error. Is there another method for accessing the home page?

Posted by Community Admin on 11-Jan-2011 00:00

Hi Vladimir,

There was a bug in the code that we fixed today that might cause this issue. I tested this scenario locally and now there should not be an issue. The fix will be included in the official release.

Regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed