R
Rod
I have an application that uses an instance of the WebBrowser control.
This WebBrowser instance stays active and is never closed while the
application runs.
I need advice on how to delete the cookies used by the WebBrowser
control.
The plan is for the application to "timeout" after a short time (30
seconds) and return to a clean state -- with all cookies from the prior
session deleted or cleared, regardless of the expiration dates set on
those cookies.
I need to clear the cookies used by the WebBrowser instance.
I have tried the following with no success:
1. webBrowser1.Document.Cookie = "";
1.a. webBrowser1.Document.Cookie = null;
For both of these, webBrowser1.Document.Cookie was unaltered, it did
not change.
2. Parse webBrowser1.Document.Cookie into a
System.Web.HttpCookieCollection, then iterate through the cookie
collection, setting cookie.Expires to a date prior to today. Then
write these cookies back to webBrowser1.Document.Cookie. This resulted
in webBrowser1.Document.Cookie having duplicate cookie items, but
without expires.
One idea may be to delete the cookies via the file system.
This WebBrowser instance stays active and is never closed while the
application runs.
I need advice on how to delete the cookies used by the WebBrowser
control.
The plan is for the application to "timeout" after a short time (30
seconds) and return to a clean state -- with all cookies from the prior
session deleted or cleared, regardless of the expiration dates set on
those cookies.
I need to clear the cookies used by the WebBrowser instance.
I have tried the following with no success:
1. webBrowser1.Document.Cookie = "";
1.a. webBrowser1.Document.Cookie = null;
For both of these, webBrowser1.Document.Cookie was unaltered, it did
not change.
2. Parse webBrowser1.Document.Cookie into a
System.Web.HttpCookieCollection, then iterate through the cookie
collection, setting cookie.Expires to a date prior to today. Then
write these cookies back to webBrowser1.Document.Cookie. This resulted
in webBrowser1.Document.Cookie having duplicate cookie items, but
without expires.
One idea may be to delete the cookies via the file system.