[Zope] How to expire cookie in DTML? Solved!

Philip Aylesworth zopelist@regalint.com
Tue, 27 Apr 1999 13:24:08 -0400


This is an interesting conversation that I am having with myself. For
the record I thought I would post what I have found.

By searching through the UserDB code I found that the author expires the
cookie with path='/' so I tried that. It worked! So if anyone wants to
use UserDB with cookies they can log out users by having a DTML method
like this:


<!--#var standard_html_header-->
<h2><!--#var title_or_id--></h2>
<P> You are now logged off.</P>
<!--#call "RESPONSE.expireCookie('__ac', path='/')" -->
<!--#var standard_html_footer-->


It works with both Netscape and MSIE.

Phil A.


> I messed around with this some more. Netscape 4.51 Mac and 4.07 WinNT do
> the same thing. My DTML seems to send the expire as described below. Out
> of desperation I tried MSIE 4.01 Mac and it worked perfectly. Aack! Has
> anyone else noticed this with Netscape? Does anyone have a workaround?
> 
> I have a building full of Netscape, which I couldn't change if I wanted
> to because we have a two groups of SGIs. I want to expire cookies set by
> UserDB to logoff users without quiting Netscape. (Quiting Netscape DOES
> work BTW).
> 
> Any help would be apprecieated. This seems like a Netscape bug though :(
> 
> Phil A.
> 
> > Well, as soon as you ask a question you find it in the docs!
> >
> > So <!--#call "RESPONSE.expireCookie('__ac')" --> should work. It trys,
> > my browser gives a message that it is getting a cookie __ac='deleted'
> > with an old date. But the cookie is still set and I can still go to
> > private pages!
> >
> > Any ideas?
> >
> > Phil  A.
> >
> > >
> > > How can I expire a cookie in DTML?
> > >
> > > I think I can figure out how to do it in an external but it would be
> > > more convenient to do it in DTML.
> > >