删除cookie失败

发布于 2024-10-13 22:24:58 字数 1103 浏览 2 评论 0原文

我面临着 cookie 的大问题。

我的域名是 abc.com

在我第一次登录 facebook connect 时,facebook 在我的计算机上创建了一个 cookie,

cookie name fbs_12345
cookie value gdgdfgdf
cookie host: abc.com

然后在我从 facebook connect 注销后。 此时,我尝试通过设置 cookie date- 10 来删除 cookie,但失败了,唯一成功的是将 cookie 值设置为“”

然后我再次通过 facebook 连接重新登录,facebook 在我的计算机上创建了另一个 cookie 此时

cookie name fbs_12345
cookie value gdgdfgdf
cookie host: .abc.com   (with a dot in front)

,我无法访问cookie 不再存在,显然这是由于 cookie 主机造成的,一个没有前缀点,一个有前缀点

如果我删除其中一个 cookie,则会显示另一个 cookie 值。

有什么办法可以干净地删除第一个 cookie?

……

Function printCookie

dim x,y
for each x in Request.Cookies

  response.write("<h3>")

  if Request.Cookies(x).HasKeys then

    for each y in Request.Cookies(x)

      response.write(x & ":" & y & "=" & Request.Cookies(x)(y))
      response.write("<br />")

    next

  else

    Response.Write(x & "=" & Request.Cookies(x) & "<br />")

  end if

  response.write "</h3>"

next

End function

I am facing a big issue with cookie.

My domain is abc.com

At the first time I login to facebook connect, facebook created a cookie at my computer as

cookie name fbs_12345
cookie value gdgdfgdf
cookie host: abc.com

Then after I logout from facebook connect.
At this point I try to delete cookie by setting cookie date- 10 but fail, the only success is set cookie value to ""

Then I relogin via facebook connect again, facebook created another cookie at my computer as

cookie name fbs_12345
cookie value gdgdfgdf
cookie host: .abc.com   (with a dot in front)

At this point, I cannot access the cookie anymore, apparently it is due to cookie host, one without prefix dot, one with prefix dot

If I delete one of the cookie, then another cookie values will show out.

Any way to do a clean removal of first cookie?

.....

Function printCookie

dim x,y
for each x in Request.Cookies

  response.write("<h3>")

  if Request.Cookies(x).HasKeys then

    for each y in Request.Cookies(x)

      response.write(x & ":" & y & "=" & Request.Cookies(x)(y))
      response.write("<br />")

    next

  else

    Response.Write(x & "=" & Request.Cookies(x) & "<br />")

  end if

  response.write "</h3>"

next

End function

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坠似风落 2024-10-20 22:24:58

我终于找到了在我的电脑上彻底删除 facebook 创建的 cookie 的解决方案。
经测试可与 chrome、firefox、IE8 配合使用。

对于我的情况,设置cookie过期是行不通的。

对我有用的解决方案:

在 ASP classic 中将 cookie 值设置为空并将 cookie 主机设置为其他域。
执行此操作后,这个特定的 cookie 将消失。

Response.Cookies("fbs_" & FACEBOOK_APP_ID) = ""

Response.Cookies("fbs_" & FACEBOOK_APP_ID).Domain = "anyotherdomain.com"

我相信如果用php编写代码,会更简单,
感谢这篇文章给出的 cookie 删除想法:

删除用户注销时我的应用程序中的 facebook 会话 cookie

I finally found the solution to do clean removal of cookie created by facebook at my computer.
Tested to work with chrome, firefox, IE8.

For my situation, set cookie to expire is not working.

The solution that works for me:

In ASP classic set cookie value to empty and cookie host to other domain.
After doing this, this particular cookie will gone.

Response.Cookies("fbs_" & FACEBOOK_APP_ID) = ""

Response.Cookies("fbs_" & FACEBOOK_APP_ID).Domain = "anyotherdomain.com"

I believe if code in php, it will be simpler,
Thanks to the cookie deletion idea given by this post:

Delete facebook session cookie from my application on users logout

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文