HTTP Cookie Detection (by server-side code)

Question:

I spoke to you earlier this morning about a problem I’m having with
using the HTTP component, and logging into Amazon. Based on the
response I’m getting I am indeed successfully logging on since it
shows my name at the top of the page. However it shows me an error
message about cookies. I do in fact know that we are receiving cookies
since it created an xml file in the cookies directory as soon as I ran
the page. Any help you can provide would be greatly
appreciated.

Answer:

I did a little research and found that there is no standard way of
detecting cookies. A typical way sites do it is to check to see if a
cookie was sent with the request. For example, when you initially
browse to the login page, you’ll get a cookie. When you submit the POST
(i.e. when you login) the cookie that came with the initial page load is
sent back, and the presence of this cookie tells the server whether or
not the browser is supporting cookies. Therefore, w/ Chilkat you would
want to first load the URL of the page containing the login form by
calling QuickGetStr. That should give you the cookie which will
automatically be sent back with the next HTTP request (assuming
SaveCookies and SendCookies) is turned on…

Followup:

That certainly seems to be what the problem was. I’ll have to keep that in mind for future deployments. Thanks for the prompt response.

Tags :