开发者

disposing and recreating a webbrowser control

开发者 https://www.devze.com 2022-12-14 08:29 出处:网络
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 t

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 co开发者_如何学Cntrol, as I would rather keep the same variable name. Any ideas welcome.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消