[thelist] removing cookies in ASP

Andrew comitque at hotmail.com
Thu Apr 29 14:42:08 CDT 2004


Hey everyone, I have a question about removing cookies in ASP.  I'm building
a shopping cart system and currently if I want to remove a cookie, I just
set it to '0'.  Is there a better way to do this?

Can I expire only one cookie in a set?

For example, if I want to keep this one:
Response.Cookies("cart")(item1)
and delete this one:
Response.Cookies("cart")(item2)

I do this:
removeItem = Request("removeitem")
For each item in Response.Cookies("cart")
    If Request.Cookies("cart")(item) = removeItem Then
        Response.Cookies("cart")(item) = 0
    End If
Next

Thanks!

Andrew


More information about the thelist mailing list