Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem retrieveing data from Cookie

Status
Not open for further replies.

jjme88

Programmer
Dec 28, 2007
58
GB
HI,

I have a curious problem, im sure I am missing something really silly. Before I post a load of code I want to check the principle of what I am doing.... incase its obvious.

In my asp.net web page I am using c# to append items to a shopping basket the data being stored in a cookie. I then display a summary of that basket in another area of the page.

As items are added to the cookie i want the summary area to auto update. what I find is that the summary area always lags one behind. ie if i add an item called 'widget1' to the basket by hitting my add button... nothing happens.. but if I then add say 'widget2' the basket summary will show there s a 'widget1' in the basket.

I then add 'widget3' and the basket will now show there is a 'widget1' and a 'widget2' in the basket and so on..

If I have a seperate 'Refresh' button the page that a user manual clicks after adding an item to the basket then the summary will look correct.

I cant help but think I am missing some general principle when dealing with cookies.

anyone got any thoughts?
 
Ive worked it out.. i have realized that its standard behavior.. when you set a cookie to update it doesn't actually happen until the currently running script completes. So if you set the values in a procedure and then try an retrieve them form another procedure in the same script run it will still get the old values.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top