Internet-Explorer – InternetExplorer.Application object and cookie container

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

Sub Main()
Dim ie As Object = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate2("http://localhost:4631/Default.aspx")
End Sub

The program uses the InternetExplorer.Application automation object to launch the IE window and navigate the given URL. The problem I have is that even if I launch multiple instances of my application, use this method to create All IE windows share the same cookie container. Are there any parameters I can specify to create a different cookie container for each window?

This is the web page I used to test cookies:

<%@ Page Language="C#" AutoEventWireup="true" %>

< br />




About CreateObject(“InternetExplorer.Application”), you can create Internet Explorer And all instances of your program communicate through this process. Cookies will be retained according to the process.

You can try to use the WebBrowser control in your application (see http:// msdn.microsoft.com/en-us/library/3s8ys666.aspx). You can find the ratio in http://msdn.microsoft.com/en-us/library/aa752044(VS.85).aspx Compare the information of the two ways. If you will use the WebBrowser control in your application, all instances of the application will have their own set of cookies, but each process has only one set of cookies, which is the same as the number of WebBrowser controls in the application. Irrelevant.

In any process, you can clear cookies at any time to follow the call

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

(see http://support.microsoft.com/kb/195192/en) again shows the nature of cookie holding.

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

Sub Main()
Dim ie As Object = CreateObject("InternetExplorer. Application")
ie.Visible = True
ie.Navigate2("http://localhost:4631/Default.aspx")
End Sub

This program uses The InternetExplorer.Application automation object to launch an IE window and navigate a given URL. The problem I have is that even if I launch multiple instances of my application, the IE windows created using this method all share the same cookie container. Are there any parameters I can specify to create a different cookie container for each window?

This is the web page I used to test cookies:

<%@ Page Language="C#" AutoEventWireup="true" %>

< br />




About CreateObject(“InternetExplorer.Application”), you can create an instance of Internet Explorer, and all instances of your program pass this One process communicates. Cookies will be retained according to the process.

You can try to use the WebBrowser control in your application (see http://msdn.microsoft.com/en-us/library/ 3s8ys666.aspx). You can find information comparing the two ways at http://msdn.microsoft.com/en-us/library/aa752044(VS.85).aspx. If you will use WebBrowser in your application Control, all instances of the application will have their own set of co okie, but each process has only one set of cookies, which has nothing to do with the number of WebBrowser controls in the application.

In any process, you can clear cookies at any time to follow the call

< /p>

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

(see http://support.microsoft.com/kb/195192/en) shows cookies again The nature of holding.

Leave a Comment

Your email address will not be published.