More in this section

Forums / General Discussions / How to get url of a page in multilanguage website?

How to get url of a page in multilanguage website?

2 posts, 0 answered
  1. Vladimir
    Vladimir avatar
    4 posts
    14 Nov 2008
    11 Jan 2011
    Link to this post
    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?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    11 Jan 2011
    Link to this post
    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.

    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
2 posts, 0 answered