request.ServerVariables("HTTP_COOKIE") weird problem

Every now and again, as an IT professional, you come across problems that defy all logical explanations, and make you ask yourself - "Is someone f***ing with me?"

Anyways, here is a problem I am facing as such:

In my asp page, request.ServerVariables("HTTP_COOKIE") is returning two separate cookie names, obviously causing me problems.  

Instead of returning just ASPSESSIONIDCSAADRAA=DKPHNFLAEDGJCHBDJLGGOAKD

it returns
ASPSESSIONIDCSAADRAA=DKPHNFLAEDGJCHBDJLGGOAKD; ASPSESSIONIDCSCBDRAA=GHDPHAJBKGJNFKOJJCNFFNKMSELECT

and YES, that semicolon is part of the string.

In my code, this is all i am doing:

tmpTable1 = request.ServerVariables("HTTP_COOKIE")

and then i use tmpTable1 throughout the page.


Finest wines and cheeses to anyone who solves this!
LVL 11
TWBitAsked:
Who is Participating?
 
Brendt HessConnect With a Mentor Senior DBACommented:
Althoough it is not covered anywhere extensively, the HTTP_COOKIE value depends entirely on what the *browser* sends back.  This entry indicates to me that the browser PC has two active (or not deleted) session cookies related to the requestor site.

If you are doing this from a test PC, try clearing out all cookies in your browser, and try again.  You should only get one value back.
0
 
jpontaniCommented:
Just split the string on the semicolon.

tmpStr = request.ServerVariables("HTTP_COOKIE")
cookieArray = Split(tmpStr, ";")

You can then loop through the array to check for the one you want (in this case it will be item 1)

tmpTable1 = cookieArray(0)
0
 
TWBitAuthor Commented:
Yeah, I was going to resort to string manipulation if all else fails, but what I would like to know is why its returning 2 cookie values.  Any ideas?
0
 
TWBitAuthor Commented:
Yup, thats the ticket.  Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.