Reputation: 31
I asked on the C# MSDN forum with no response. =[ Basically I have made a programme which automates a website with several different accounts, one after the other. However the website stores a cookie to save the account to the computer so you can't log another account into the site for about 4 days. I can delete the cookie; however because my app hosts the web browser I need to be able to effectively restart it to the cookie from the temp file as well. Is there any way I can dispose and then recreate the control, as I would rather keep the same variable name. Any ideas welcome.
Upvotes: 1
Views: 1330
Reputation: 15271
This applies to file cookies: How to clear the cache when your application hosts a WebBrowser control in Visual C# .NET
For http-only cookies, use InternetSetCookieEx.
Upvotes: 1
Reputation: 19661
If you want to automate interaction with a website, you should use HttpWebRequest
rather than a web browser control. The CookieContainer
can hang on to cookies as long as you need them.
Upvotes: 0