Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Sharing same cookie between server and client

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
arijitdas@gmail.com - 14 Feb 2008 18:28 GMT
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!
Anthony Jones - 15 Feb 2008 10:09 GMT
> Hi,
>
[quoted text clipped - 8 lines]
> 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.

Signature

Anthony Jones - MVP ASP/ASP.NET

arijitdas@gmail.com - 17 Feb 2008 18:03 GMT
> <arijit...@gmail.com> wrote in message
>
[quoted text clipped - 23 lines]
> --
> 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!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.