cookies don't work for pages with UpdatePanel

J

John Grandy

Is anyone finding that cookies added to the Response.Cookies collection
within pages which contain an UpdatePanel do not exist in the
Request.Cookies collection when the page is posted back ?

These should be complete page postbacks not partial postbacks, because the
postback in question is not triggerred by a control inside the UpdatePanel
(nor is it a trigger control for an UpdatePanel), but, not knowing all the
details of how AJAX works, perhaps it is possible that XmlHttpRequest is
handling the postback even in this case and does not handle Cookies properly
....
 
B

bruce barker

updatepanels use ajax to postback via XMLHttpRequest. the ajax request
will send the browser cookies, but the browser does parse the response
headers, so it will not see a cookie headers added.

this means if you set a cookie is a partial update, the browser will not
see, and can not send on a full post. this is why partial page updates
do not update session/login cookie timeouts.


-- bruce (sqlwork.com)
 
J

John Grandy

But I'm not adding/setting my cookies during a partial update. I'm using
Page.Response.Cookies.Add during the initial page load ... but on post back
Page.Request.Cookies does not contain the cookie.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top