【发布时间】:2010-05-19 09:47:46
【问题描述】:
我有以下用 VB.NET 编写的控制台应用程序:
Sub Main()
Dim ie As Object = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate2("http://localhost:4631/Default.aspx")
End Sub
这个程序使用InternetExplorer.Application 自动化对象来启动一个 IE 窗口并导航给定的 url。我遇到的问题是,即使我启动了我的应用程序的多个实例,使用这种方法创建的 IE 窗口都共享同一个 cookie 容器。我可以使用任何参数来指定为每个窗口创建不同的 cookie 容器吗?
这是我用来测试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>
【问题讨论】:
标签: internet-explorer cookies automation