We help IT Professionals succeed at work.

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

steve-e-b
steve-e-b asked
on
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
Comment
Watch Question

ahosangFinance Systems Developer

Commented:
If your cookies have different names, there shouldn't be a problem. Could you show us your code for setting both cookies?

Author

Commented:
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.
Just for the record, this problem disappeared when we upgraded Tomcat.
So I suspect there was a bug in v3.2.1
CERTIFIED EXPERT

Commented:
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

Explore More ContentExplore courses, solutions, and other research materials related to this topic.