Everything,
Although I see related topics on the forum, I do not see a clear solution to this problem. I am trying to set javax.servlet.http.Cookie with an expiration date (so that it is saved in browser sessions). The code:
public void respond(HttpServletRequest req, HttpServletResponse resp) { int expiration = 3600; Cookie cookie = new Cookie("TestCookie", "xyz"); cookie.setDomain(""); cookie.setVersion(0); cookie.setPath("/"); cookie.setMaxAge(expiration); cookie.setSecure(false); resp.addCookie(cookie); }
I do not see this cookie set when I check the IE developer tools. A search on the Internet made it clear that IE does not take into account Max-Age, but only works with Expires. If this does not work for IE, is there a proven way to set the HTTP response headers for a persistent cookie so that it works for IE?
PS: This works great in all other browsers.
I tried to create a string for the cookie with the expires attribute. IE managed to create it, but it lost the domain (the default is β)β and showed β.comβ and turned it into a session cookie instead of a persistent cookie. This works fine again in all other browsers.
Please, help. Thanks.
cookies persistent
thebigg
source share