Question regardning urls in episerver



I have a copule of pages that have short urls given on them (page.Property["PageExternalUrl"]) now I'm in a situation where I need to get the "long friendly external url" (normal freindly url you get when short url is empty) programmaticly. Is there a way to get this url from pagedata object in a "good performance way" when you have given short url of given page?


#65169 Jan 22, 2013 15:56
  • Per Magne Skuseth
    Member since: 2009

    Hi M,
    you could try this:

            public static string GetFriendlyUrl(PageData page)
                UrlBuilder url = new UrlBuilder(page.LinkURL);
                url.QueryLanguage = page.LanguageBranch;
                return url.ToString();


    #65210 Jan 23, 2013 10:13

    Thansks, but I've tried that. If current page has short url given I get the short url not the "friendly-long-url".... maybe its because of  custom made urlprovider in my case... i'll have to look into that... thanks!


    #65211 Jan 23, 2013 10:30
  • Per Magne Skuseth
    Member since: 2009

    Oh, I see. However, in a standard 6 R2 site, the "GetFriendlyUrl" method I posted should still return the friendly url, and not the simple address. So yeah, checking custom code would probably be a step in the right direction :-)

    It's also possible to turn of simple addresses, byt setting enableSimpleAddress="false" in web.config.

    #65213 Edited, Jan 23, 2013 11:17