Click here to Skip to main content
15,891,907 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more: (untagged)
Hi all,

I have a problem with cookies.

I use a cookie with key/value pairs for storing articles.
I have a button "Add article" which adds a key/value pair to the cookie.
When the page reloads I need to access all the values in the cookie and display them.

the problem is that when the button is clicked the cookie is added to the Response and will not be present in the Request until another reload since - I guess - the button event handler is being executed during the page load.
If I add an article it won't show up until I do another reload on the page.

Does anybody have an idea how I can add the cookie with a button and have the value in the Request when the page loads next time.

Hope someone out there understands what I'm trying to explain.

Thank you for your help!!
Posted

1 solution

Whatever code you have to display the articles can be called from 2 places from page_load and the same code can be called in the button event handler after you add the article to your cookie.
 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900