Understanding PageData.LinkURL

Vote:
 

Okay, so I only just realised that this PageData.LinkURL actually outputs strings that look like this: /Views/Pages/BlogListingPageTemplate.aspx?id=303&epslanguage=en-GB

I'm presuming the output HTML response is then being rewritten before sending to the browser based on all the routing. (I'm using WebForms by the way, don't know if it is different for MVC).

What I've also noticed is that depending on where I am writing this to depends on whether it gets rewritten, so all seems okay if I write it to a <a href=""> but not so much if I just put it as text in a page for example.

Is there an easy way to get the final output URL as I'm executing my page or block code behind? And is there anything I might need to be aware of if appending query string parameters for in page functionality?

#86973
Jun 05, 2014 13:01
Vote:
 
var url = UrlResolver.Current.GetUrl(currentPage.ContentLink);
#86975
Jun 05, 2014 13:27
Vote:
 

Thanks! Until now I had realised there was a difference in output between the method, I shall now be more careful which I use in future.

#86977
Jun 05, 2014 13:38
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.