Avatar of shafferb1
shafferb1
 asked on

asp/vbscript ServerXMLHTTP cookies

I have code similar to the following. The returned page is the logged in page as expected. However, no cookies are returned in the header which is:

Date: Mon, 19 Mar 2012 10:58:03 GMT Server: Apache/2.0.64 (Unix) mod_ssl/2.0.64 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 X-Powered-By: PHP/5.2.9 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html

I really want to return the cookies and their values. Any idea why this is not working?

set xmlObj = Server.CreateObject("Microsoft.XMLDOM")
Set xmlHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
xmlHTTP.Open "POST","http://www.domain.com/",false
xmlHTTP.SetRequestHeader "Content-type", "application/x-www-form-urlencoded"
xmlhttp.setrequestheader "Cookie","cookie2=boom"
xmlhttp.setrequestheader "Cookie","cookie1=dummy"
xmlHTTP.Send "username=xxxxx&action=Login&password=yyyyy"

strheaders=xmlhttp.getallresponseheaders()

response.write "<p>" & (strheaders) & "</p>"

response.write (xmlHTTP.ResponseText)

Open in new window

ASPWeb ComponentsWeb Development Software

Avatar of undefined
Last Comment
shafferb1

8/22/2022 - Mon
sammySeltzer

Try setting the cookies in one go.


'this value is ignored, but the step is necessary
xmlhttp.setRequestHeader "Cookie", "dummy"
'set all cookies here
xmlhttp.setRequestHeader "Cookie", "cookie1=boom; cookie2=dummy"

Open in new window

ASKER CERTIFIED SOLUTION
shafferb1

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
shafferb1

ASKER
no correct answer
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck