首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

请教在WebBrowser模拟登陆后,怎么让弹出的窗口在IE打开

2012-06-12 
请问在WebBrowser模拟登陆后,如何让弹出的窗口在IE打开让做一个自动登陆139邮箱的工具。我于是用WinForm的W

请问在WebBrowser模拟登陆后,如何让弹出的窗口在IE打开
让做一个自动登陆139邮箱的工具。
我于是用WinForm的WebBrowser做了一具工具,即自动填入 “用户名”,“密码”,并点击“登陆”。
但是WebBrowser很容易崩溃,于是想点“登陆后”,让新打开的邮箱Web页面在默认浏览器,如在IE中打开。
请问如何实现?
其中涉及到两个问题:
1.登陆后的窗口如何在IE打开,而不是在WebBrowser中
2.Session如何共享?
谢谢!


[解决办法]

C# code
public Form1(){    InitializeComponent();    this.webBrowser1.Navigate(你的登录网址);    this.webBrowser1.Navigated += new WebBrowserNavigatedEventHandler(webBrowser1_Navigated);// 注册 Navigated 导航完成后 事件}private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e){    this.webBrowser1.Navigating += new WebBrowserNavigatingEventHandler(webBrowser1_Navigating); // 第一次导航完成后注册 Navigating 导航开始之前 事件}private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e){    System.Diagnostics.Process.Start(e.Url.ToString());    e.Cancel = true;    this.webBrowser1.Navigated -= new WebBrowserNavigatedEventHandler(webBrowser1_Navigated);    this.webBrowser1.Navigating -= new WebBrowserNavigatingEventHandler(webBrowser1_Navigating);} 

热点排行