| Author |
Message |
Guest
|
Posted:
Sat Jan 08, 2005 9:00 am Post subject:
Disappearing Cookies |
|
|
I'm writing a web part and want to persist the state of the page. As
the user changes items on the page, I use script to set a cookie:
document.cookie = CookieName=" & State
I then read the cookie from the web part:
Dim Context As System.Web.HttpContext =
System.Web.HttpContext.Current
InitState = Context.Current.Request.Cookies("CookieName").Value
If I change the page (and thus call the script), then refresh the page,
the web part reads the cookie correctly. If I navigate away from the
page then back, however, the cookie disappears.
I've tried changing the 3d-party cookie settings in IE -- no change.
TIA for any advice.
Dave James |
|
| Back to top |
|
 |
Guest
|
Posted:
Sat Jan 08, 2005 9:27 am Post subject:
Re: Disappearing Cookies |
|
|
Script should be:
document.cookie = "CookieName=" & State
Dave James |
|
| Back to top |
|
 |
Kyle Petersen
Guest
|
Posted:
Mon Jan 17, 2005 12:29 am Post subject:
Re: Disappearing Cookies |
|
|
Make sure you are writing your cookie to the
Context.Current.Response.Cookies so that the cookie gets sent back to the
browser.
Kyle
<dmjames@earthlink.net> wrote in message
news:1105153243.774765.309280@c13g2000cwb.googlegroups.com...
| Quote: | I'm writing a web part and want to persist the state of the page. As
the user changes items on the page, I use script to set a cookie:
document.cookie = CookieName=" & State
I then read the cookie from the web part:
Dim Context As System.Web.HttpContext =
System.Web.HttpContext.Current
InitState = Context.Current.Request.Cookies("CookieName").Value
If I change the page (and thus call the script), then refresh the page,
the web part reads the cookie correctly. If I navigate away from the
page then back, however, the cookie disappears.
I've tried changing the 3d-party cookie settings in IE -- no change.
TIA for any advice.
Dave James
|
|
|
| Back to top |
|
 |
|
|
|
|