Disappearing Cookies
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Disappearing Cookies

 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development
Author Message
Guest






Posted: Sat Jan 08, 2005 9:00 am    Post subject: Disappearing Cookies Reply with 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
Guest






Posted: Sat Jan 08, 2005 9:27 am    Post subject: Re: Disappearing Cookies Reply with quote

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 Reply with quote

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
 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB