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
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