Skip to main content
January 5, 2012
Question

Strange cookie issue(s)

  • January 5, 2012
  • 1 reply
  • 2345 views

I posted a long time ago about why cfcookie was not working well in IE.  What was happening was that no matter what I did (expires="now", structdelete, cflogout) the cookies persisted on the local machine and could not be deleted.  It only happened in IE.  We decided the problem was related to the domain http://mydomain.com vs. http://www.mydomain.com.  Since then I've done a 301 redirect so that the www. prefix will be appended to all pages and the cookie problem is still occurring.

The question is, what is the most effective way of permanently deleting a cookie using coldfusion 9???  Please don't use expires="now", structdelete, or cflogout as an answer because none of those work.

Thanks!

This topic has been closed for replies.

1 reply

Community Expert
January 5, 2012

The question is, what is the most effective way of permanently deleting a cookie using coldfusion 9???  Please don't use expires="now", structdelete, or cflogout as an answer because none of those work.

Really? Setting the EXPIRES attribute has always worked for me. So, I suspect something else is happening than what you think.

Dave Watts, CTO, Fig Leaf Software

Dave Watts, Eidolon LLC
January 5, 2012

That isn't helping much.

Here's a good example....

I run a .cfm page that has the following code.  My cookie named site_username was: billygoat

---------------------------

<cflogout>

<cfcookie name="site_username" expires="NOW">

<cfset delete_username=StructDelete(cookie,"site_username")>

---------------------------

The result?  billygoat

12Robots
Participating Frequently
January 5, 2012

Did you check the HTTP response from that request to see if a new SET-COOKIE was being sent?  I am unsure of the result of deleting the key formt he cookie struct after you set the cookie?  Will it even be sent at all?  And what is the point of deleting the key for that matter?  Delete the third line of your example code and try it again.

Jason