Link to home
Start Free TrialLog in
Avatar of TWBit
TWBitFlag for United States of America

asked on

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!
Avatar of jpontani
jpontani

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)
Avatar of TWBit

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of Brendt Hess
Brendt Hess
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TWBit

ASKER

Yup, thats the ticket.  Thanks!