tags:

views:

334

answers:

2

basically i am setting cookie values on the client side (just session cookies, without any expiry date) and i am making ajax requests, now, in my ajax requests, i never get the updated cookie value as i've set in the client using javascript.

so, do ajax requests ignore sending updated cookie values from teh client to the server? or whats the deal with that?

if not, would viewstate which i update on client using javascript be sent to the server between ajax requests? i am developing in asp.net 4.0/vb.net/vs2010

A: 

I thought that with a Ajax request no cookies are sended? But sending the session id in the ajax request (as a 'GET' var) can help to use the session after all.

VDVLeon
cookies are sent with XHR requests. It's just like a regular request, it just happens in the background ...
Jan Hančič
I don't know realy. On my server (apache 2, php5) in combination with Firefox and javascript Mootools Ajax request the session cookie was never set. The only solution was sending the session id manual (as a GET var)
VDVLeon
i checked cookie value in client after i set it, its correct, then right after i make the ajax request, it is not updated on the server (using Request.Cookies("cookieName").Value .... ?? any ideas?
Erx_VB.NExT.Coder
VDVLeon your answer looks more like a comment than a suggestion or answer. Please use the comment field on existing answers if you dont add answers :-) and no, I didnt vote you down. Somebody else did.
BerggreenDK
+1  A: 

Guess what? I figured it out, it was a logic error on my behalf... always remember to check...

If Page.IsPostBack Then

since ajax requests do call PageLoad every single time! - yep, my values were being reinitialized ot the initial values after each ajax request ;?!!!!

thanks

Erx_VB.NExT.Coder