Windows Phone 7 Clear Cookies

Is it possible to clear cookies created using the WebBrowser control in Silverlight on Windows Phone 7?

+4
source share
4 answers

According to this post , cookies cannot be accessed through the API. However, they can be accessed through javascript in the built-in browser (remember to set .IsScriptEnabled = true ).

To iterate over all cookies and delete thme, you can try something like:

 var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; i++) { eraseCookies(cookies[i].split("=")[0]); } 

Or, if eraseCookies do not work (I did not check), you can try:

 createCookie(cookies[i].split("=")[0], "", -1); 
0
source

I read this on my blog yesterday, but now I can’t find the link. In short: 1. Create an HttpWebRequest server. 2. Attach a collection of cookies to it. 3. Keep a link to this HttpWebRequest throughout the life of the application. 4. The cookies of the WebBrowser control will always be displayed in this HttpWebRequest CookieCollection. If you want to delete them, repeat this cookie CookieCollection and mark each of them as "Expired".

I'm not sure if the above will work, but you can always try.

0
source

Another solution I came across was to actually log out immediately after the initial OAuth2 handshake.

So, as soon as I have my final OAuth2 token, I will quickly go to the exit page, allowing in most cases to clear cookies.

0
source

All Articles