The key to the cookie is the domain/path and the name of the cookie.
Watch out for the defaults. If you are in
www.myco.com/dir1/dir2/some.html, you may get a different default path
then you get from www.myco.com/dir5/some.html. The domain of the cookie
that is written you become www.myco.com/dir5 therefore the key to the
new cookie that you are writing may be different from the one that you
are attempting to kill.
Solve this problem by Always explicitly setting domain *and* path.
//find the cookie from the cookeArray
if (cookieArray[i].getName().equals("MY_COOKIE_NAME")) {
//explicitly set the domain. You may have different server names in
your organization.
//you can't set the domain to cookieArray[i].getDomain() since it is
not sent from browser to server.
//cookieArray[i].getDomain() will return null.
cookieArray[i].setDomain("www.vacation.com");
//set the path explicitly too.
cookieArray[i].setPath("");
cookieArray[i].setMaxAge(0);
response.addCookie(cookieArray[i]);
}
--
Tom
Thomas Preston
Vacation.com, Inc.
Engineering Department
617.210.4855 x 124
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html