tags:

views:

25

answers:

2

Is there a reliable way of round tripping a HTTP cookie value exactly once?

e.g.

Set-Cookie: name=value; Max-Age=1;

...but Max-Age is in delta seconds not #requests.

The reason why I ask is this, http://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-get/1353717#1353717

+2  A: 

You mean you want it to go there, come back, and disable it when you receive it again?

On that basis it's quite simple, set a flag in the cookie, then check it, and expire it immediately next time you get it.

Or do you mean something else?

Noon Silk
Nope, that's it, but is there's no mention of this in http://tools.ietf.org/html/rfc2965.
John Leidegren
The reason why I ask is this http://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-get/1353717#1353717
John Leidegren
A: 

Are you asking if the cookie can be sent back with the next request but not subsequent ones after that?

If so then I don't think that's possible when the cookie is set. What you can do is in your server side code check if you received the cookie, which presumably you do anyway or why would you need it, and send an empty cookie to remove it in the response to that request.

John Burton