setDomain() on Cookies not working
843833Sep 21 2001 — edited Nov 30 2001Hi,
I 've seen this error reported a lot of times in this forum and none of them have a satisfactory answer. So I am repeating it and hope to hear from somebody abt this.
Here goes....
I created a cookie and tried to access it from another server in the same domain. Did not work. So I added the setDomain() statement and guess what.. even the cookie does not get created now...
I have looked into the RFC 2109 and everything seems to be ok in my programs.
I know people dont like it when someone pastes their entire code in these forums. So I am just going to paste a teeny weeny part where I am actually setting the cookie..
String domainName = ".cha.tva.gov";
Cookie userCookie = new Cookie("someid", "somevalue");
userCookie.setPath("/");
userCookie.setMaxAge(1200);
userCookie.setDomain(domainName);
res.addCookie(userCookie);
Any input will be appreciated. Thanks.