InternetExplorer.Application object and cookie container

前端 未结 1 1710
攒了一身酷
攒了一身酷 2021-01-06 02:59

I have the following console application written in VB.NET:

Sub Main()
    Dim ie As Object = CreateObject(\"InternetExplorer.Application\")
    ie.Visible =         


        
相关标签:
1条回答
  • 2021-01-06 03:20

    With respect of CreateObject("InternetExplorer.Application") you create an instance of Internet Explorer and all instances of you program communicate through this one process. Cookies will be hold per process.

    You can try to use in your application WebBrowser control instead (see http://msdn.microsoft.com/en-us/library/3s8ys666.aspx). You find in http://msdn.microsoft.com/en-us/library/aa752044(VS.85).aspx information which compare two ways. If you will use WebBrowser control in you application all instances of your application will have his own set of cookies, but only one set of cookies per process independent on the number of WebBrowser controls in your application.

    Inside of any process you can any time clear the cookie with respect of following call

    InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0);
    

    (see http://support.microsoft.com/kb/195192/en) which shows one more time the nature of cookies holding.

    0 讨论(0)
提交回复
热议问题