I have list of press releases in a landing page. When you click on that it should open the respective Press release page (detail page).

This works fine in Live, but in staging the link is going to the Live URL.

The below code is used to construct Live URL.

How can I construct a URL which works for stage as well as for live?

string pressReleaseUrl = "http://";

string[] liveUrlSplit = LiveUrl.Split('/');
for (int i = 1; i < liveUrlSplit.Length - 1; i++)
    pressReleaseUrl += liveUrlSplit[i];
  • 1
    Is this C# code that runs in a TBB? Or in an ASPX page? And where does the value of LiveUrl come from? Apr 8, 2014 at 11:00
  • 5
    This question appears to be off-topic because it is about generic web programming, not specific to Tridion. The link being constructed is not using Trdion's API, but some custom mechanism. Apr 8, 2014 at 11:33
  • 4
    I'm probably missing a lot of context... but why are you not using Dynamic Linking? Looks like the use case it was created for.
    – Nuno Linhares
    Apr 8, 2014 at 17:01

1 Answer 1



Page.ResolveUrl("~/" + relativeUrl)

The relativeUrl should be relative to the web app root. e.g. "press-releases/my-press-release.aspx".

Not the answer you're looking for? Browse other questions tagged or ask your own question.