Re: Trying to send cookies with POST.

Giganews Newsgroups
Subject: Re: Trying to send cookies with POST.
Posted by:  Caleb (no…
Date: Fri, 7 May 2004

Good news!
It finally works now :)

The problem was with the way POST data was sent.
I'm still surprised why TIdMultiPartFormDataStream didn't work!

I've done something like this:
Data := 'bla=' + HttpEncode(something) + '&blah2=' + HttpEncode(etc..);

And it worked perfectly :)

"Caleb" <no…> wrote in message
> Hey,
> I'm trying to make a program that directly submits data to a webpage.
> The thing is, that the web page requires a user to be logged in in order
> submit the page.
> I've sniffed the POST data with the browser, and I've spotted that it
> cookies like this:
> Cookie: name=caleb; pass=mypassword;
> ASP.NET_SessionId=eoli0n45up0lbc550rkecwup
> So basically, If I send those headers along with the POST then it wont
> complain.
> I've tried using:
> http.CookieManager.AddCookie('name=caleb', '');
> http.CookieManager.AddCookie('pass=mypassword', '');
> and then Http.Post(..)
> That did not work!
> Then i've tried modifying the Custom headers and adding this line:
> Cookie: name=caleb; pass=mypassword
> Then I've called Http.SetHeaders; Http.Post(...)
> That seemed to work for a test file on my localhost (it recognized the
> cookies)
> But for the target webpage it did not work. It looked like that my cookies
> were overriden by their SESSIONID cookie (i've compared the sent headers
> with the recieved headers. In the recieved headers my cookies were absent)
> I'm all out of ideas :(
> Is there anyone who could help me with this?



In response to

Trying to send cookies with POST. posted by Caleb on Sat, 1 May 2004