Delete key\value pairs from a cookie

W

Warp

If I have a cookie with 'key/value' pairs, how would I delete a
specific 'key/value' pair while preserving the remaining pairs? I
tried to do something like:
cookie(key)=""
but it didn't seem to work. I do not want to expire the cookie, just
to delete the specified key. I'm working in javascript.
Thanks in advance.
 
M

Manohar Kamath

Try something like

Response.Cookies("MyCookie")("MyKey") = '';

I am guessing you are working on Javascript on the server side, am I
correct?
 
W

Warp

Manohar thank you for your reply.

Anyway, the problem was that I was replacing the old cookie with it's value
minus the pair I wanted to delete. This method generates two cookies with the
same name and different paths...a little bit strange. I found that putting
the path in the new cookie solves the problem.

Warp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top