volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

URL Rewriting internal URL properties

Hi,

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:

/Templates/Public/Pages/Page.aspx?id=53

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,

Karl. 

#31183
Jul 07, 2009 11:06

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

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!

Karl. 

#31245
Jul 14, 2009 10:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.