For Programmers: Free Programming Magazines  


Home > Archive > ASP > October 2004 > Delete key\value pairs from a cookie









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Delete key\value pairs from a cookie
Warp

2004-10-28, 3:55 pm

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.
Manohar Kamath

2004-10-28, 3:55 pm

Try something like

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

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

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com


"Warp" <roxana.turcu@scop.ro> wrote in message
news:2267d508.0410280535.5503a801@posting.google.com...
> 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.



Warp

2004-10-28, 3:55 pm

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

"Manohar Kamath" wrote:

> Try something like
>
> Response.Cookies("MyCookie")("MyKey") = '';
>
> I am guessing you are working on Javascript on the server side, am I
> correct?
>
> --
> Manohar Kamath
> Editor, .netWire
> www.dotnetwire.com
>
>
> "Warp" <roxana.turcu@scop.ro> wrote in message
> news:2267d508.0410280535.5503a801@posting.google.com...
>
>
>

Paxton

2004-10-31, 8:55 pm

Try a javascript group.

"Warp" <roxana.turcu@scop.ro> wrote in message
news:2267d508.0410280535.5503a801@posting.google.com...
> 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.



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com