views:

315

answers:

1

I'm getting a cookie on a page load (from 3rd party) and need to use its attributes on the same context, however it is available only after the page is refreshed (reloaded).

Is there a way to programatically refresh/reload the cookies in HttpContext.Current?

A: 

No. Cookies are set/updated as part of the response to an HTTP request. When you get the cookie from a request it won't change until you spit a response back.

So why not just have the changed value as a property on your page class, set it during page load, make your changes it to it then use the property throughout your page flow, using it to update it at the end?

blowdart
Thanks for your quick reply.I am not sure what are you suggesting, the cookie properties aren't available through the whole page flow, until a complete refresh. It is the refresh I would like to avoid. is it possible? If so please try to detail how.Once again, thanks.
Wineshtain
Ah maybe I'm not clear. Cookies don't get set until the page is completed, which is why you're not seeing the values until a reload is performed. So any values you set in the cookie collection don't hit the browser until the page is sent back. Maybe you could expand on what you're seeing and what you want to do?
blowdart