This blog is subject the DISCLAIMER below.

Tuesday, November 18, 2008

Limitations on using Cookies

Make note of the following limitations when using Cookies (I'm not sure if that applies to all Web-technologies or just Asp.Net, but I've just solved a bug related to this issue using Asp.Net):

  • A cookie size is limited to 4096 bytes. It is not much, so cookies should be used to store small amounts of data. For larger amounts of data
  • Also, number of cookies is limited to 20 per website. If you make new cookie when you already have 20 cookies, browser will delete oldest one.
Quoted from beansoftware.com

1 comment:

Anonymous said...

"(I'm not sure if that applies to all Web-technologies or just Asp.Net, but I've just solved a bug related to this issue using Asp.Net)"

It's a browser limitation and not related to the web technologies ... and recently browsers start avoiding these limitations and increase those variables.

Microsoft indicated that Internet Explorer 8 increased the cookie limit per domain to 50 cookies

Firefox has a per-domain cookie limit of 50 cookies.

Opera has a per-domain cookie limit of 30 cookies.

Safari/WebKit is the most interesting of all as it appears to have no perceivable limit through Safari 3.1. I tested setting up to 10,000 cookies and all of them were set and sent along in the Cookie header. The problem is that the header size exceeded the limit that the server could process, so an error occurred.


good luck :)