Link to home
Start Free TrialLog in
Avatar of steve-e-b
steve-e-b

asked on

Tomcat's session cookie destroyed by JavaScript cookie ...

Hi,

I am using Tomcat v3.2.1 and session cookies to track visitors' movement around the site (logging-in, etc).
I also want to use JavaScript to set a permanent cookie that stores details about the machine being used.

The problem is that when the cookie is set on the client side, Tomcat's session cookie is lost. Consequently, the system thinks the user has not logged-in.

I can only think of two possibilities. Either the JavaScript engine overwrites the session cookie with the permanent cookie. Or Tomcat cannot handle two cookies (one session, one permanent) being sent in the request.
This happens in both IE (v5.0) and NN (v4.7).

Has anyone ever come across this problem before?
Is there a Tomcat setting that I am overlooking?
Does anyone know of a related bug in this version of Tomcat?

Many thanks,
Steve
Avatar of ahosang
ahosang
Flag of United Kingdom of Great Britain and Northern Ireland image

If your cookies have different names, there shouldn't be a problem. Could you show us your code for setting both cookies?
Avatar of steve-e-b
steve-e-b

ASKER

The Javascript statement that sets the permanent cookie is:

document.cookie = this.name + "=" + escape(value) + expireStr;

where:
     this.name is 'OCS-quicktest'
     value is     'dont run'
     expireStr is '; expires=Thu, 12 Dec 2002 09:49:04 UTC'


The session cookie is handled by Tomcat, so I don't have the code.
I suspect the bug is in Tomcat (v3.2.1) because when I run the system on my local machine for testing I use a different web-server and the problem does not occur.
ASKER CERTIFIED SOLUTION
Avatar of steve-e-b
steve-e-b

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 periwinkle
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area with the following recommendation for this question:

PAQ/Refund

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

periwinkle
EE Cleanup Volunteer