Coldfusion - Grabbing the Cookie Value from the ResponseHeader?

Hi Folks,

I'm hitting a brick wall with this one.

I'm using CFHTTP to attempt a login (and later, a file download) on a remote server.  I've managed to accomplish this by passing a static cookie value within the cfhttpparam, though obviously in reality I'm going to need to get this 'on the fly' (the cookie is a session variable, I logged in manually to find it, then ran my cfhttp immediately after before the session expired).

So far, I've got so far as to getting in and retrieving the cfhttp responseheader.  A cfdump shows me the value is there, I simply can't figure out how to grab it so I can pass it onto the next cfhttp request.

Existing code shown below (I've also attached a screenshot of the cfdump so you can see the responseheader as I'm seeing it;
<!--- Simple cfhttp to grab the headers --->
<cfhttp url="" method="post" result="getCookie">
<cfhttpparam type="header" name="txtUsername" value="myuser">
<cfhttpparam type="header" name="txtPassword" value="mypass">

<cfdump var="#getCookie#">

<cfset thisCookie = ListGetAt(getCookie.responseHeader["Set-Cookie"],1,"=")>
<!--- The Above shows me only the Cookie Name (in this instance ASP.NET_SessionId) --->

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It you wanted the value, you'd need to grab the second position

 <cfset thisCookie = ListGetAt(getCookie.responseHeader["Set-Cookie"], 2,"=")>

But I'm not sure this is the right way to pass the information along.  

<cfset thisCookie = ListGetAt(getCookie.responseHeader["Set-Cookie"], 2,"=")>
<cfset thisCookie = ListGetAt(thisCookie, 1,";")>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ReveroomAuthor Commented:
Excellent, thanks agx - much appreciated.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.