OpenEdge.Net.HTTP Cookie management

Posted by Andrei Popa on 16-Jun-2017 03:50

I am currently working on a project where we add cookies to an IHttpResponse in a WebHandler.
That works nicely using the IHttpResponse.SetCookie method.
The problem now is that I want to remove the cookie I set, but in another request
Is this possible?

Posted by Andrei Popa on 21-Jun-2017 04:58

We finally managed to delete the cookie from the front end, the incorrect domain was used when trying to remove it.

I also believe you can do this, not by adding the cookie with no value, as David Cleary suggested, but by adding it as expired.

All Replies

Posted by Peter Judge on 19-Jun-2017 09:03

Are you keeping the response object around?

There is a RemoveCookie() method on the HttpResponse object that you can use to remove cookies. Or am I misunderstanding?

Posted by David Cleary on 19-Jun-2017 12:06

If it is to remove the cookie from the remote browser, wouldn’t you just add the cookie with no value?
 
Dave
 

Posted by Andrei Popa on 21-Jun-2017 04:58

We finally managed to delete the cookie from the front end, the incorrect domain was used when trying to remove it.

I also believe you can do this, not by adding the cookie with no value, as David Cleary suggested, but by adding it as expired.

Posted by Andrei Popa on 21-Jun-2017 05:01

The problem is that I want to remove it in a subsequent request, not the current one, after it has been set in the remote browser. I tried the RemoveCookie method, but I think that only affects the HttpResponse's cookie container.

Posted by Andrei Popa on 21-Jun-2017 05:21

I haven't tried that but I believe that if you set it as expired it should work.

Thanks for the tip!

This thread is closed