File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cookies getting lost in Internet Explorer

 
Arti Soni
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps if you showed us your cookie-setting code...
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the name of the missing cookie ?
 
NareshA WaswaniA
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic