?
Solved

request.ServerVariables("HTTP_COOKIE") weird problem

Posted on 2004-10-27
4
Medium Priority
?
1,088 Views
Last Modified: 2008-01-09
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!
0
Comment
Question by:TWBit
  • 2
4 Comments
 
LVL 5

Expert Comment

by:jpontani
ID: 12424227
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
 
LVL 11

Author Comment

by:TWBit
ID: 12424348
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
 
LVL 32

Accepted Solution

by:
Brendt Hess earned 750 total points
ID: 12425251
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
 
LVL 11

Author Comment

by:TWBit
ID: 12425524
Yup, thats the ticket.  Thanks!
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question