473,287 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Sharing same cookie between server and client

Hi,

We have an ASP.NET 2.0 web application where we want to share few user
specific data between server and client side code using cookie. We are
seeing a very strange behavior that it does not work consistently.
Sometimes we are getting the latest value set from server in client
script, sometimes were are getting a wrong (previously set old) value.
In other words, the values in client and server is not in sync.

Can anybody suggest what are the parameters we should be checking to
debug this? We are using the same cookie name with the same 'path' in
both server and client side code. Client browser IE6.

Thanks!
Feb 14 '08 #1
2 2123
<ar*******@gmail.comwrote in message
news:9a**********************************@i29g2000 prf.googlegroups.com...
Hi,

We have an ASP.NET 2.0 web application where we want to share few user
specific data between server and client side code using cookie. We are
seeing a very strange behavior that it does not work consistently.
Sometimes we are getting the latest value set from server in client
script, sometimes were are getting a wrong (previously set old) value.
In other words, the values in client and server is not in sync.

Can anybody suggest what are the parameters we should be checking to
debug this? We are using the same cookie name with the same 'path' in
both server and client side code. Client browser IE6.
Have you got a small repro for this I can't reproduce it. IE always has the
latest value of the cookie as sent by the server, and I can't see a way the
Server won't send a Set-Cookie header when the cookie is modified.

Is it possible that where you expect a cookie to be changed by server side
code serving a request it isn't because a cache is supplying the response
instead. Could be the client cache, a proxy or even the Response cache on
the server.
--
Anthony Jones - MVP ASP/ASP.NET
Feb 15 '08 #2
On Feb 15, 3:09 pm, "Anthony Jones" <A...@yadayadayada.comwrote:
<arijit...@gmail.comwrote in message

news:9a**********************************@i29g2000 prf.googlegroups.com...
Hi,
We have an ASP.NET 2.0 web application where we want to share few user
specific databetweenserverandclientside code usingcookie. We are
seeing a very strange behavior that it does not work consistently.
Sometimes we are getting the latest value set fromserverinclient
script, sometimes were are getting a wrong (previously set old) value.
In other words, the values inclientandserveris not in sync.
Can anybody suggest what are the parameters we should be checking to
debug this? We are using the same cookie name with the same 'path' in
both server and client side code. Client browser IE6.

Have you got a small repro for this I can't reproduce it. IE always has the
latest value of the cookie as sent by the server, and I can't see a way the Server won't send a Set-Cookie header when the cookieis modified.

Is it possible that where you expect a cookie to be changed by server side
code serving a request it isn't because a cache is supplying the response
instead. Could be the client cache, a proxy or even the Response cache on
the server.

--
Anthony Jones - MVP ASP/ASP.NET
Yes, Anthony I was also thinking that the client cache might be
causing the problem, but again that seems to be unusual... Can you
please suggest a way to check this or a fix for this? I tried by
cleaning the browser cache. No luck.

Here's a bit more details of the problem: We have a page/code (say
Page1.aspx) that gets called for all client request and we apply
custom user authorization there. We are using a cookie to keep the
user credential information (combination of form authentication cookie
and some other custom information). This cookie is shared between
global.asax, Page1.aspx and client script. We create the cookie in
Page1.aspx, update it conditionally in global.asax and read it from
client script. When we try to read the value in client script, we are
seeing that it's having the value set in Page1.aspx. Even if we are
modifying the same cookie in global.asax, that value is not reflecting
in client script. As an alternative, if we create a new cookie from
global.asax, we can easily get the correct value. But we don't have
any clue of why it's behaving that way!
Feb 17 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: chrism | last post by:
Hello, I have a pop-up window that I would like to appear in front of the browser home page when a user opens IE. Problem is, I'd like it to never appear again if the user navigates back to the...
7
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local...
1
by: brad | last post by:
Hi, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
15
by: Oleg Leikin | last post by:
Hi, (newbie question) I've created some simple .NET ASP application that should store cookies at the client machine. According to the documentation cookie expiration time is set via...
3
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code...
23
by: Phil Powell | last post by:
// OBTAINED FROM http://www.javascripter.net/faq/settinga.htm // NOTE THAT IF YOU SET days TO -1 THE COOKIE WILL BE SET TO YESTERDAY AND THUS EXPIRE function setCookie(name, value, days, docObj)...
9
by: Mike Reed | last post by:
I must be having a "senile" day! I cannot recall, nor get to work, code to read a cookie's expiration date/time in an ASP page/VBScript. What am I missing? *** Sent via Developersdex...
7
by: Nils Hedström | last post by:
I have a web farm that uses a state server for session management. A user logs on to a website (www1.mysite.com). When the same user visits www2.mysite.com I want the user to be logged in. Right...
5
by: cbhoem | last post by:
Hi - I am trying my hand at python cookies. I'm confused about a few things though. Do the python cookies get written to a cookies text file? I have simple code below -- I see the cookie in...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.