InternetExplorer.Application object and cookie container
- by Darin Dimitrov
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 that I encountered is that even if I launch multiple instances of my application, the IE windows that are created with this method all share the same cookie container. Is there any parameter I could use specifying that a different cookie container is created for every window?
This is the web page I used to test cookies:
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
// Store something into the session in order to create the cookie
Session["foo"] "bar";
Response.Write(Session.SessionID);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<form id="form1" runat="server"></form>
</body>
</html>