Number and size limits of a cookie in Internet Explorer
This article was previously published under Q306070 SUMMARY
Microsoft Internet Explorer complies with the following RFC 2109 recommended minimum limitations:
MORE INFORMATION
Each cookie begins with a name-value pair. This pair is followed by zero or by more attribute-value pairs that are separated by semicolons. For one domain name, each cookie is limited to 4,096 bytes. This total can exist as one name-value pair of 4 kilobytes (KB) or as up to 20 name-value pairs that total 4 KB. If the computer does not have sufficient space to store the cookie, the cookie is discarded. It is not truncated. Applications should use as few cookies as possible and as small a cookie as possible. Additionally, applications should be able to handle the loss of a cookie. If a Web application uses more than 19 custom cookies, ASP session state may be lost. Internet Explorer 4.0 and later versions allow a total of 20 cookies for each domain. Because ASPSessionID is a cookie, if you use 20 or more custom cookies, the browser is forced to discard the ASPSessionID cookie and lose the session. To store more than 20 name-value pairs for a domain, you can create a cookie dictionary by concatenating several name-value pairs for each cookie up to the 4,096-byte limit for that cookie. Currently, to retrieve these values from client-side scripting, you must parse the cookies manually. However, the Active Server Pages Request and Response objects include built-in functionality to work with cookie dictionaries as dictionary objects. The following sample code demonstrates the use of cookie dictionary in an ASP page: Note In Internet Explorer 5.0 and later, you can use the userData behavior to persist data across sessions. This behavior has a greater capacity than cookies.
If you use the document.cookie property to retrieve the cookie on the client side, the document.cookie property can retrieve only 4,096 bytes. This byte total can be one name-value pair of 4 KB, or it can be up to 20 name-value pairs that have a total size of 4 KB. The document.getcookie function calls the CDocument::GetCookie method in Microsoft HTML. For more information, click the following article number to view the article in the Microsoft Knowledge Base: 820536 (http://support.microsoft.com/kb/820536/)
Document.Cookie property returns an empty string
REFERENCES
For more information about the RFC 2109 specifications, see the following Web sites:
Internet Engineering Task Force (IETF)
For more information about the Cookies collection, see the following Microsoft Developer Network (MSDN) Web site:
http://www.ietf.org/rfc/rfc2109.txt (http://www.ietf.org/rfc/rfc2109.txt) World Wide Web Consortium (W3C) http://www.w3.org/Protocols/rfc2109/rfc2109 (http://www.w3.org/Protocols/rfc2109/rfc2109) http://msdn.microsoft.com/library/en-us/iissdk/iis/ref_vbom_reqoccookie.asp (http://msdn.microsoft.com/library/en-us/iissdk/iis/ref_vbom_reqoccookie.asp)
For more information about the userData behavior, see the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/ms531424.aspx (http://msdn2.microsoft.com/en-us/library/ms531424.aspx)
For more information about cookies, see the following Cookie Central Web site:
http://www.cookiecentral.com/ (http://www.cookiecentral.com/)
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
157906 (http://support.microsoft.com/kb/157906/)
How to maintain state across pages with VBScript
175167 (http://support.microsoft.com/kb/175167/) How to store State in Active Server Pages applications
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:http://msdn.microsoft.com/ie/ (http://msdn.microsoft.com/ie/) Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.http://support.microsoft.com/iep (http://support.microsoft.com/iep) APPLIES TO
| Article Translations
|
Back to the top
