Cookies seem to disappear
ulf.engstrom at b2b-link.com
Thu Dec 7 04:52:24 EST 2000
The browser will only save the cookie if you specify where the cookie later
will be used, that means, you have to set the Domain of the cookie:
c['state']['Domain'] = 'www.yourplace.com'
Also, not all (old) webservers handle max-age correctly, and if you still
have problems after adding domain to your cookie, maybe just try Expires
instead of max-age.
Cookies explained: http://home.netscape.com/newsref/std/cookie_spec.html
> I am trying to use SmartCookie class to store state. Everything works
> perfectly until I exit my browser. The next time I try to view the page
> my state has been reset to the default values. I set the 'max-age'
> value like so:
> c = Cookie.SmartCookie()
> c['state'] = stateDictionary
> c['state']['max-age'] = '3600'
> print c.output()
> I've tried Netscape on WinNT and Linux and IE on WinNT, they all exhibit
> same behaviour. The thing that is throwing me is that everything works
> exit my browser. It is as if I'm not setting the max-age correctly but
> how difficult can that be?
> Thanks for your help.
More information about the Python-list