We had a similar problem with cookies, but not the session
cookie.  Maybe this info will help nevertheless.

We noticed the server wasn't seeing the cookie whenever
we clicked on a form's submit button.

What happened was, all our forms were JSP's and our form
handlers were servlets.  Even though the JSP's and servlets
were in the same context, by default the cookies were set
for the exact path that the JSP or servlet was in.

E.g: our cookie was set for:

 domain/test/test.jsp

and when we submitted the form, it was at:

 domain/servlet/test.handler

the client wasn't sending the cookie because of the minor path
difference, forcing the server to try to set a new one.

We solved it by using the setPath("/") method when we created
the cookie.  This made the cookie "valid" for the whole server
(root path and all subdirectories) - see Hunter, first ed. p204.

Good Luck,
-Steven

On Wed, 4 Apr 2001, Milt Epstein wrote:

> Date: Wed, 4 Apr 2001 14:34:27 -0500 (CDT)
> From: Milt Epstein <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: RE: Session problem -- sessions being recreated, browser related?
> 
> On Wed, 4 Apr 2001, Warren Crossing wrote:
> 
> > check ie.. it stores all cookies in a folder called cookies
> > somewhere each cookie in a seperate file.. however theres an
> > index.dat .. no idea what this does but you could delete it
> > ( backup!! ) and all the cookies.. ( ??sorry??  but i've had this
> > "general cookie issue" with netscrap and ie. )
> 
> Thanks for the response.  I already tried this.  But note that the
> session id cookie is not persistent, so it won't be stored there (or
> anywhere on the hard disk), it only exists in the browser's memory
> while it's running.  Anyway, I do know that the cookie is getting
> there, because I set the browser to ask me if I want to accept
> cookies, and I see the cookie appearing each time.  So the cookie is
> apparently being set fine by tomcat and being accepted fine by the
> browser, it looks like the problem is on the next request, tomcat
> isn't finding the cookie (and since this worked fine using a different
> web server/servlet container, the probably apparently has to do with
> apache/tomcat).  (I haven't yet, but I plan to try to put something in
> place so I can get a better idea of exactly what's being passed back
> and forth on the request/response.)
> 
> 
> > -----Original Message-----
> > From: Milt Epstein [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, 4 April 2001 6:07 AM
> > To: [EMAIL PROTECTED]
> > Subject: Session problem -- sessions being recreated, browser related?
> > 
> > 
> > On a servlet-based application I have, I'm getting sporadic reports of
> > problems from users.  The symptoms are similar to what happens when
> > cookies are disabled (but they aren't, because I had the users check).
> > Basically, they can't get past the front page of the application,
> > because it won't let them without a valid session (recall that session
> > access is handled via cookies -- I'm not using URL Rewriting).  And
> > each time they try, Tomcat is creating a new session for them (and
> > giving them a new cookie).  Apparently, it's not recognizing the
> > existing session.
> > 
> > Now, this is only happening to a small subset of the users.  I haven't
> > isolated a pattern yet, but it may only be happening from certain
> > machines.  And the couple of machines I have found the problem on so
> > far are both using Internet Explorer version 4.0.  So that might be a
> > factor.  (I don't have 4.0 myself, but I did find an old copy of 3.02,
> > and it works OK with that.)
> > 
> > Oh, a bit of background -- we switched over from using Netscape
> > Enterprise Server and ServletExec to Apache/Tomcat a couple of weeks
> > ago, and the problem seems to have only started occurring since then.
> > So it does appear to be something Apache/Tomcat-specific.
> > 
> > Thanks.
> 
> Milt Epstein
> Research Programmer
> Software/Systems Development Group
> Computing and Communications Services Office (CCSO)
> University of Illinois at Urbana-Champaign (UIUC)
> [EMAIL PROTECTED]
> 

Reply via email to