Microsoft KB Archive/232907

= FIX: Random Cookies Disappear When Different Cookie Is Set to Nothing in Internet Explorer 4 and 5 =

Article ID: 232907

Article Last Modified on 9/23/2005

-

APPLIES TO


 * Microsoft Active Server Pages 4.0
 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0

-



This article was previously published under Q232907



SYMPTOMS
In Active Server Pages (ASP) pages, cookies appear to work but then suddenly "disappear." This occurs only when you view the pages with Microsoft Internet Explorer 4 and 5, not Internet Explorer 3.

If you loop through the Response.Cookies collection, you may see the name of the missing cookie separated by a semicolon from the name of a cookie that was set to an empty string.



CAUSE
Internet Information Server 4/Active Server Pages don't handle nameless cookies correctly. Nameless cookies get concatenated before the next cookie name. Consider the following valid cookie headers from the browser: SomeNamelessValue; cookie2=ABC; You cannot use the following to get the value of cookie2: Request.Cookies("cookie2") Instead, you can use the following to get the value ABC: Request.Cookies("SomeNamelessValue;cookie2")



RESOLUTION
There are two workarounds for this problem:
 * "Expire" the cookie.
 * Set the cookie to some known value that means it is empty, and then test for that value in the code, instead of testing for an empty string.



STATUS
This problem was corrected in Windows NT 4 Service Pack 6.



MORE INFORMATION
This bug became apparent because of a change in behavior between Internet Explorer 3 and Internet Explorer 4/5.

In Internet Explorer 3, you could use the following to set a cookie value to nothing: Response.Cookies("cookie1")="" The browser would return a cookie header that looked like this: cookie1=; However, in Internet Explorer 4 and 5, the equal sign is dropped and the following cookie header is returned to the server: cookie1;

Additional query words: cookies

Keywords: kbbug kbfix kbqfe kbhotfixserver KB232907

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.