拒不删除的cookie [英] a cookie that refuses to delete

查看:125
本文介绍了拒不删除的cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在传统的ASP删除了cookie的问题。设置和检索的cookie进行的非常棒,没有​​问题,在多个领域。删除的cookie是没有的。结果
拒不删除cookie将超时,并删除自身在原超时,但是这不是一个选项。结果
我已经通过的文​​件看,堆栈溢出,堆栈交易所(Web应用程序)(的一些问题是相似的,给了我一些问题的答案,但不一样的),饼干中心和MSDN。结果
更新页面到ASP.NET是此时不选择一个选项。
Cookie值和名称都与一家领先的O,以消除与加密数据和脚本语言(ASP,VBScript中,Jsvascript,SQL)与人物有问题的任何可能的问题十六进制数。结果
需要注意的是一些不同的尝试都注释掉。结果

I am having a problem with deleting cookies in classic ASP. Setting and retrieving the cookies is working wonderfully, without problems, on multiple domains. Deleting the cookies is not.
The cookie that refuses to delete will time out and remove itself on the original timeout, but that is not an option.
I've looked through the documentation, stack overflow, Stack Exchange (web applications) (some of the problems are similar and gave me some of the answers, but not the same), cookie central, and MSDN.
Updating the pages to ASP.NET is not an option at this time. The cookie values and names are in hexadecimal with a leading "O" to eliminate any possible problems with the encrypted data and the scripting languages (ASP, VBScript, Jsvascript, SQL) having problems with the characters.
Note that some of the different attempts are commented out.

Sub Set4HrCookie(ByVal CookieName, ByVal CookieValue)
    Response.Cookies(CookieName).Expires = DateAdd("n", 240, Now())
    Response.Cookies(CookieName).Domain = ".mydomain.net"
    Response.Cookies(CookieName).Path = "/"
    Response.Cookies(CookieName) = CookieValue
    Response.Cookies(CookieName).Secure = FALSE
End Sub

Sub Set1DayCookie(ByVal CookieName, ByVal CookieValue)
    Response.Cookies(CookieName).Expires = Now() + 1
    Response.Cookies(CookieName).Domain = ".mydomain.net"
    Response.Cookies(CookieName).Path = "/"
    Response.Cookies(CookieName) = CookieValue
    Response.Cookies(CookieName).Secure = FALSE
End Sub

Sub KillThatCookie(ByVal CookieName)
    Response.Cookies(CookieName).Domain = ".mydomain.net"
    Response.Cookies(CookieName).Path = "/"
    Response.Cookies(CookieName).Expires = Now() ' Now() - 1 ' #01/01/1999#
    ' Response.Cookies(CookieName).Secure = FALSE
    Response.Cookies(CookieName) = ""
End Sub

一个cookie被拒绝删除的一个例子:

An example of a cookie that is refusing to delete:

O9DCCF20B15CA0F382184A96BAB
OFA86B660438C4863797E4485DE
mydomain.net/

下面是一些给我的信息的网址。结果
你要当您清除出来,否则不会清除出来分配.domainname.com表示域。结果
http://forums.asp.net/t/1399232.aspx/1 结果
与传统的ASP结果的域值饼干
http://blurbly.net/5_5.htm

编辑:的进一步测试显示,由于路径是在饼干中,路径被要求对杀。
结果编辑:这是IIS 6 - 这似乎是类似于用VB6 INI文件已知的错误。当程序命中INI文件太快,系统无法跟上和INI文件损坏情况。

Further tests have shown that because the "Path" was used on the cookie, the "Path" was required on the "Kill".
This is IIS-6 - it appears to be similar to the known error with VB6 INI files. When a program hits the INI file too fast the system can't keep up and INI file corruption happens.

推荐答案

终于我找到了答案。我们的网站同时使用中HTTPOnly cookie和标准饼干。问题是,IIS无法处理。要么所有Cookie中HTTPOnly或无。其中一人被被设置两种方式,在那之后所有的非中HTTPOnly饼干未被删除。
该KillThatCookie保持相同。一天的设置cookie的就变成了:结果

At long last I found the answer. Our site was using both HTTPOnly cookies and standard cookies. The problem is that IIS can't handle that. Either all cookies are HTTPOnly or none. One of them was being set both ways, all non-HTTPOnly cookies after that were not deleted. The KillThatCookie remains the same. The set cookie for one day becomes:

Sub Set1DayCookie(ByVal CookieName, ByVal CookieValue)
Dim strGMTDateRFC22
    strGMTDateRFC22 = GetServerUTC("d", 1) ' 1 Day Cart Session Expiration
    Response.AddHeader "Set-Cookie", CookieName & "=" & CookieValue & "; expires=" & strGMTDateRFC22 & "; domain=.mydomain.net; path=/; HttpOnly"
End Sub

此外,用下划线饼干 - ,括号(),和号&放大器;是有问题的,他们不一定会删除我敢肯定,有更多的字符,但文件说,这些。是有效的,它们可能是有效的,但它们会导致问题。
结果
编辑:的看来,有更给它。多重超时也是一个问题。结果
编辑:的部分问题是我们加密,这使得它的键区分大小写

Also, Cookies with an underscore "-', parenthesis"()", ampersand "&" are problematic. They won't necessarily delete. I'm sure that there are more characters, but the documentation says that these are valid. They may be valid, but they cause problems.
edit: It appears that there is even more to it. The multiple timeout is also a problem.
edit: Part of the problem is we're encrypting the keys which makes it case sensitive.

这篇关于拒不删除的cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆