Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Cookie problems and HTMLHTTP

I am trying to execute an auto-login into a https server.
I used the XMLHTTP30 server object successfully for 18 months.
Now something has changed on this server so that when i try execute the auto login, it says that 'Cookies are not enabled on my browser'.

When i copy and paste the login url into IE6 browser, the login works perfectly. I check my cookies folder and they are there.
When i use the XMLHTTP object to do the same thing, it doesnt work, and no cookies get dropped onto the client machine.

The code snippet is as follows:

Dim httpSocket As New MSXML2.ServerXMLHTTP
xURL = "https://example.com/login"
param = "username=test&password=123"

httpSocket.Open "POST", xURL, False
httpSocket.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
httpSocket.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
httpSocket.send param

MsgBox httpSocket.getAllResponseHeaders

d = Now
Do Until DateDiff("s", d, Now) > 30 Or blnComplete
If httpSocket.readyState = 4 Then blnComplete = True
DoEvents
Loop
If Not blnComplete Then
MsgBox "No Response from the server."
httpSocket.abort
End If

What i dont understand is if the url works by copying and pasting into the browser, why doesnt it work with the xml object? Am i missing something in the headers? Why are the cookies not getting dropped onto the client?

Thank you in advance.
[1528 byte] By [joshry] at [2007-11-11 8:19:40]