[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

How to pass an Ampersand in a Redirect?

I have a link which carries a URL as a variable. When clicked, the link goes to another page where I do something behind the scenes with other info and then I redirect to the url variable specified (#trackingSite#). But the refresh with the url carried over in the link will not pass correctly? When looking at this, is there a simple solution I'm overlooking? Am I going about this wrong in the first place? Any advice would so appreciated.

Caveat: I know passing all of the information in an href in this manner is not ideal; I've inherited this and don't have a choice.
The link which is on page A:

 <a href="searchAdmin/act_recordTracking.cfm?trackingID=#trackingID#&trackingSiteID=#trackingSiteID#&trackingSite=#URLEncodedFormat(trackingSite)#" target="_blank" class="trackingListLink">#trackingSite#</a>

Page B (searchAdmin/act_recordTracking.cfm) takes the other information, does some stuff and then refreshes the page with the trackingSite URL. 

<!---redirect --->
<meta http-equiv="refresh" content="1; url=#trackingSite#">

Open in new window

2 Solutions
Replace all ampersands with their html numeric entity.

<!---redirect --->

I wonder if you can URLencode it again?

<meta http-equiv="refresh" content="1; url=#URLencodedFormat(redirect_url)#">

(you do have CFOUTPUT around this statement already I assume? )
can you post the code where you set trackingSite ?
why aren't you using cflocation?
traportAuthor Commented:
Thanks so much. I'm sorry it took me so long to get back to your solution. I used bits and pieces of both solutions.

I'm not using cflocation b/c it wouldn't process anything before the cflocation - I couldn't figure out how to "delay" a cflocation! Hope that makes sense.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now