Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

PageReference.ParseUrl not working after upgrade to 8.8.0

Vote:
 

I have an EPiServer.Url propertyon one of my block types.

In version 7.15 I used to be able to parse out the PageReference this Url represented. and if it was a CMS use another extension method to render the simple address for the page.

I have upgraded from this version to 8.8.0 and now it fails to parse the Url property to extract the PageReference.

var pageReference = PageReference.ParseUrl(MyUrlProperty.ToString());

I noticed that the 7.15 url property is in the format: /link/486c6b7755d34e219d0afa93123ff9b9.aspx?id=9021

whereas the 8.8.0 is in the format: /link/486c6b7755d34e219d0afa93123ff9b9.aspx

So it looks like its dropped the ?id= query parameter.

Is there a new way to parse these EPiServer.Url properties ? any advise on how to continue to process them as I have been doing ? i.e. transforming to PageData if possible so I can render its simple address ?

regards,

Danny

#144520
Feb 15, 2016 10:39
Vote:
 

UrlResolver is your new friend I think

#144523
Feb 15, 2016 11:07
Vote:
 

Ok,

Thanks Dan for the reply.

Do you know what methods exactly I need to use on UrlResolver to get if possible a PageData object from an EPiServer.Url property ?

#144525
Feb 15, 2016 11:20
Vote:
 

UrlResolver.Route(urlBuilder) returns an IContent which you can cast to PageData

#144544
Feb 15, 2016 14:38
Vote:
 
<p>Yup, UrlResolver is your way to convert back and forth between urls and IContent. Put in one thing and get the other :)</p> <p>Route to get IContent and GetUrl to ...get url :)</p>
#144545
Feb 15, 2016 14:42
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.