Thanks, I always tough that with ajax requests cookies were not sended.
This is my first application that mixes ajax requests and session
tracking, and becaus I was not able to read session info, I immediately
assumed that (and i think i had read that somewhere). But the problem
was with the info... My bad, but thanks anyway.

Cheers,
Hernâni

Sex, 2007-08-24 às 10:39 -0400, Christopher Schultz escreveu:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hernâni,
> 
> > I'm developing a webapp that does lots of ajax requests, but I need to
> > keep track of the session. What I do is to read the JSESSIONID cookie
> > with javascript and send the value as a POST parameter when I make the
> > request, but then tomcat doesn't open the session automaticaly.
> 
> That's because Tomcat doesn't read POST parameters to look for a session
> id. You need to encode the session id in the URL if you are not sure
> that your browser will send a cookie.
> 
> Try something like this:
> 
> var sessionId = .... ; read cookie
> var URL = "http://...../foo/bar.baz;"; + sessionId + "?param=value&"
> Note that this is all very silly, since you're using javascript to sniff
> the sessionid from a cookie. If you already have a cookie, then the
> browser /is/ using cookies, and you don't need to do any of this since
> the browser will send the cookie to the server automatically.
> 
> - -chris
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFGzu2t9CaO5/Lv0PARAvURAJ9RXeteg31i2VconN67NaChphXtWgCgw207
> FwfauFTn+WvmJ9m/Aea/tmQ=
> =L5Bf
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to