Maintaining Sessions Across Multiple ColdFusion CFHttp Requests

<!---
	Get the URL of the application page that we want to
	grab. This page lives under a different application
	and will have different session management (that we
	must account for in subsequent requests).
--->
<cfset strURL = (
	CGI.server_name &
	GetDirectoryFromPath( CGI.script_name ) &
	"/app/index.cfm"
	) />
 
 
<!---
	Store the user agent that we want to send (so CFHttp
	doesn't send "ColdFusion" as the user agent). Since I
	am testing this in a browser, I am just going to grab
	the current user agent.
--->
<cfset strUserAgent = CGI.http_user_agent />
 
 
<!---
	Grab the first page request. In this one, we are not
	going to sent any CFHttpParams since we don't know
	anything about the target application environment.
--->
<cfhttp
	method="GET"
	url="#strURL#"
	useragent="#strUserAgent#"
	result="objGet"
	/>
 
<!--- Dump out the CFHttp response. --->
<cfdump
	var="#objGet#"
	label="First CFHttp Request"
	/>
 
 
<!---
	Now, let's make a second request, same as the first
	to see what gets send back.
--->
<cfhttp
	method="GET"
	url="#strURL#"
	useragent="#strUserAgent#"
	result="objGet"
	/>
 
<!--- Dump out the CFHttp response. --->
<cfdump
	var="#objGet#"
	label="Second CFHttp Request"
	/>

For Cut-and-Paste