Microsoft Knowledge Base Email Alertz

(232907) - 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,...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 232907 - Last Review: September 23, 2005 - Revision: 2.1

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

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;
				

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
Keywords: 
kbhotfixserver kbqfe kbbug kbfix kbqfe KB232907
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate