URL Rewriting internal URL properties

Karl Alesbury
Member since: 2009


You may be seeing quite a bit of me at the moment!

I have added a property to a pagetype of type "URL to page/external address". I then went to edit a page of that pagetype, and chose to link to an internal page.

The trouble with this is that it's inputting the RAW URL into the field when I've selected a page. So I'm getting something like:


The trouble with is is that I'd like the re-written version instead.

Is it supposed to save the raw URL like this?

Thanks very much,


#31183 Jul 07, 2009 11:06
  • Ulrik Andersson
    Member since: 2005

    The question is what you want to do with the property data. If you simply output it on a page as for example a href it will "automagically" be rewritten by a httphandler. If you want to work eith the url in the codebehind only you can do something like this

    UrlBuilder url = new UrlBuilder((string)CurrentPage["MyUrlProperty"])

    EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, null, Encoding.UTF8);

    string friendly = url.Uri.OriginalString


    If you have the PageReference to the page you should pass that instead of null in the example above.

    #31195 Jul 07, 2009 23:53
  • Karl Alesbury
    Member since: 2009

    Ah okay. Yeah that's what I was trying to avoid!

    I'll give that a shot. 

     Thanks very much for your help, appreciated as always!


    #31245 Jul 14, 2009 10:16