Re: unsetting a cookie
On Aug 30, 5:28 am, ed wrote:
> Hi,
>
> I'm having a little trouble removing a cookie from the response
> (SF_NOTIFY_SEND_RESPONSE). The problem that I have is that several
> cookies are set, so it seems impossible to me that I can remove a given
> cookie by name.
>
> What I thought might be sensible is to store the cookies that do not
> match the name that I am trying to remove in a buffer, then remove all
> cookie headers using setheader against "Set-Cookie" to do this, and
> iterate over the buffer to reset only the wanted cookies.
>
> How can I get all the header data, or a list of the set headers?
You can easily get the list of Set-Cookie: headers in
SF_NOTIFY_SEND_RESPONSE. Please read the documentation for
SF_NOTIFY_SEND_RESPONSE event and its context structure
HTTP_FILTER_SEND_RESPONSE
IIS does not buffer the response so it will not give you all the
header data, but you can also get all header data if you are willing
to buffer and parse the output response stream yourself. However, this
approach has many other caveats.
Finally, your approach assumes that all "Set-Cookie:" response headers
are present in SF_NOTIFY_SEND_RESPONSE. It may not be true 100% of the
time, depending on your server's configuration, so you may/not need to
worry. However, you need to verify that you are not affected because
if you are, it will likely be for 100% of your responses.
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
date: Fri, 31 Aug 2007 14:29:58 -0700
author: David Wang