Search code examples
cookiesasp-classiccorruption

Classic Asp: Cookie corruption issue


There is an ASP application made to co-exist with other .net web apps. The cookies for the asp page is actually written to the client from an aspx page. So we have something like:

Response.Cookies("Credo")("ID") = "ido sans lum"

sent to the client.

The ASP page receives this cookie, but strangely gives corrupt results:

sID = Request.Cookies("Credo")("ID") ' this gives "idosanslum"

Unfortunately I don't understand why. I checked HTTP_COOKIE server variable in ASP, and even it said something like:

HTTP_COOKIE:...;Credo=ID=ido sans lum&DomainID=5&...;...

So I believe this means the cookie is being sent from the browser correctly, but Request.Cookies("Credo")("ID") is giving me wrong results.

Am I messed up with some configuration or is this a known bug.


Solution

  • There is a KB article on this problem at the Microsoft support site: http://support.microsoft.com/kb/262444

    Hope this helps.

    Update: The proposed fix from the article is to encode your cookie content. In Classic ASP I think the following will work:

    Response.Cookies("Credo")("ID") = Server.URLEncode("ido sans lum")
    

    Please give it a go and let me know what you find.