I'm actually creating a disclaimer page that redirects the users.  So the user 
sees a disclaimer page indicating they are leaving the site and connecting to 
an outside site.  Then they get redirected to that site.  For some reason my 
disclaimer redirect code wasn't working correctly for links that had multiple 
url variables in it.  It would get cut off after the end of thefirst url 
variable.  The user wouldn't get redirected to the page intended b/c of this.  
For instance lets say a user clicked on a link on my page that went to: 

http://go.reuters.com/newsArticle.jhtml?type=healthNews&storyID=12037965&src=eDialog/GetContent

My page would actually have this as the link 
http://someurlhere.com/disclaimer.cfm?destination=http://go.reuters.com/newsArticle.jhtml?type=healthNews&storyID=12037965&src=eDialog/GetContent

the disclaimer.cfm would look something like this:

<cfset destination=url.destination>

<script language="JavaScript" type="text/javascript">
        <!--
        function dspDisclaim(){
          setTimeout('window.location.href="#destination#"',10000);
        }
        //-->
</script>

Now this worked fine when there wasn't multiple url vars in the original link, 
but as you can see this reuter link has mutliple vars in it.

So to fix it so that all the url vars got included in my redirect i did this:

<cfset destination="">

<cfif StructCount(url) GT 1>
        <cfset destination = url.destination>
        <cfset structDestinationRemove = StructDelete(url, "destination", 
"true")>
        
        <cfloop collection=#url# item="urlVar">
                <cfset destination = destination&"&"&urlVar&"="&url[urlVar]>
        </cfloop>
<cfelse>
        <cfset destination = url.destination>
</cfif>

This actually recontructed the URL correctly with all the URL vars, but the 
problem is this particular link is case sensitive and does not work when the 
url vars got recontructed in uppercases letters.

Maybe I'm doing the whole redirect thing incorrectly or theres an easier way.  
But if anybody can help me out, I would appreciate it.  Thanks.

>I don't think you can. CF is case-insensitive for one thing.
>
>It looks like case MIGHT be preserved in CGI.QUERY_STRING. So you could
>try the following:
>
><cfloop list="#CGI.QUERY_STRING#" delimiter="&" index="keyvalue">
>       <cfoutput>#listFirst(keyvalue,"=")# =
>#listLast(keyvalue,"=")#</cfoutput>
></cfloop>
>
>A couple of problems with that, of course:
>
>- Any URL variables you've explicitly set (such as with cfparam) or
>removed won't be accounted for.
>- You need to care for instances when there is a key but no value.
>"key1=&key2=a"
>
>Why do you need to see your URL variables in their original case?
>
>
>
>
>-----Original Message-----
>From: Tuan Tran [mailto:[EMAIL PROTECTED] 
>Sent: Friday, May 05, 2006 11:35 AM
>To: CF-Talk
>Subject: URL Structure
>
>Hi Everybody,
>
>I'm trying to get the name/value pair from url variables.  Lets say I
>have a url like this:
>
>http://someurlhere.com?Src=blahblah&storyID=1234
>
>Now if I do the following I'll get the name/value pair of the URL vars:
>
><cfloop collection=#url# item="urlVar">
>  <cfoutput>#urlVar# = #url[urlVar]#</cfoutput><br /> </cfloop>
>
>My problem is the name element doesn't keep the same case as the actualy
>url variable name.  Src and storyID gets displayed as SRC and STORYID in
>the output.  How can I keep the case the same when I loop thru the URL
>structure?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239643
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to