• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cookies getting lost in Internet Explorer

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am writing about 20 cookies using a common method through java on one of the pages and trying to read them on next page. In Internet Explorer one of the cookie is not available. There is no place in between where the cookie is getting overwritten / deleted. Also the code works perfect in mozilla but not in Explorer. The strange thins is everytime the same cookie is not available.
Can anyone please suggest what could be going wrong.

Regards Arti.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps if you showed us your cookie-setting code...
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when you say 'next page', is this in the same window or are you opening a new window? There is a known issue with some versions of IE where sessions can get lost when opening a new window, and I presume cookies are the same.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a Microsoft article on limitations on cookies in MSIE
Summarized:

Microsoft Internet Explorer complies with the following RFC 2109 recommended minimum limitations: •at least 300 cookies
•at least 4096 bytes per cookie (as measured by the size of the characters that comprise the cookie non-terminal in the syntax description of the Set-Cookie header)
•at least 20 cookies per unique host or domain name



Bill
 
Arti Soni
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The follwoing is the code where i am writing cookies -

public void createCookies(HttpServletRequest request, HttpServletResponse response, Hashtable cookieVals, int maxAge, String path, String domain){
Enumeration cookieKeys = cookieVals.keys();
System.out.println("Writing cookies.......\n");
while (cookieKeys.hasMoreElements()) {
String cookieKey = (String)cookieKeys.nextElement();
String cookieKeyVal = (String)cookieVals.get(cookieKey);
Cookie cookie = new Cookie(cookieKey, cookieKeyVal);
System.out.println("key " + cookieKey);
System.out.println("Value " + cookieKeyVal);
cookie.setPath(path);
//cookie.setDomain(domain);
cookie.setMaxAge(maxAge);
cookie.setVersion(1);
response.addCookie(cookie);
}
}

In the above code, the hashmap contains the name value pairs of the cookies being written and the maxAge variable being passed is -1.

The next page is getting loaded in the same window and not a new window.

Also the values that are being written in the cookies are just code values so are not too large and also the maximum number of cookies being written is not more than 25.

Thanks
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's the name of the missing cookie ?
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in internet explorer, you can have at the max 20 cookies from one host.

that is he main reason. i think the cookies are getting more than 20.

+91-9986461501
 
Arti Soni
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it documented somewhere that there can be only 20 cookies in IE ? Also the cookies that get lost are not the last ones in the hashmap.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is it documented somewhere that there can be only 20 cookies in IE ?


William was so kind to include a link to the relevant documentation in his post.

Also the cookies that get lost are not the last ones in the hashmap.


Since it is not guaranteed that more than 20 will be supported, trying to guess which ones beyond that will be ignored is just idle speculation.

I'd question any design that relies on this many cookies to begin with. Can you tell us why you think that's necessary?
 
Arti Soni
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The content for the page is to be picked up from Documentum and since that reads cookies all the data had to be transferred from request/hidden fields to the Cookies.
 
NareshA WaswaniA
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what if the cookie is not supported. In that case will your application not work.

And more over in the case of cookies, you never know the way the cookies are sent : in which order. So even if the end cookies in the hasmap are not missing, quiet possible that they are going in the starting of the sequence. So you never know the exact sequence.

+91-9986461501
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that an applications main feature should not be built around cookies.Not , at least for a completely web based applications , where you do not know the settings of the browser that the client might be using.But there are few other stuffs to look at for tracking client sessions.

But its fine for web based products as products will have a system requirement where the vendor might say that for running this application cookies must be allowed.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic