The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

I have a question similar to "how to retrieve cookies" ( but in my case I have to deal with multiple cookies.

When i try this example, it sort of works, but the cookie is only the last cookie pair in the response. Here's the cookie info it shows in the query result (attribute,value): 'Set-Cookie','BIGServer-8080=123432138.36895.0000; path=/'

But in Mozilla I can inspect the cookie that gets returned, and it has 11 sets of cookies in the Cookie result. (eg, something like this. values have been changed, shortened to protect privacy):; BlahTicket=12341341234123%7C41ee026bc0000000%7C41df3c04d7800000%7C; BlahUser=blaha%7C41ee026bc0000000%7C41df3c04d7800000%7C; BIGServer-8080=123432138.36895.0000;

How can I get all the other cookie pairs? I'm using Sqlanywhere 10.0.1 build 4135. Thanks,

asked 24 Oct '11, 14:44

mxmoss's gravatar image

accept rate: 0%

Your web request returns the cookie information in its headers. If you look at my answer to the question you will see that the code retrieves the cookie value by looking at the 'set-cookie' header that is returned from the call to the web service. If more than one cookie is being returned then one of two different scenarios can occur:

  • each cookie is being set by using separate set-cookie headers - in this case you need to look at each set-cookie header in the header list (not just the first or last) and extract the information that you need
  • more than one cookie is being set in each set-cookie header - in this case you need to split the attribute value of the set-cookie header at the semicolon (easily done using sa_split_list( attribute, ';' )) and then extract the cookie value out of each piece.

Also please remember that your browser will remember (cache) cookies from one web service call to the next. This can be important to keep in mind if the web service(s) that you are using is(are) setting one cookie per web service call and you are making multiple calls and hence getting multiple cookies - i.e. since your browser caches the cookies you will get the list of all cookies that you have been given during your session (or longer).

permanent link

answered 24 Oct '11, 15:01

Mark%20Culp's gravatar image

Mark Culp
accept rate: 40%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 24 Oct '11, 14:44

question was seen: 943 times

last updated: 24 Oct '11, 15:01