当前位置:编程学习 > C#/ASP.NET >>

webbrowser控件打开的新窗口怎么保持登录?

webbrowser控件里的网站里面链接打开了一个新窗口,由于弹出的新窗口里显示内容需要验证session,弹出的新窗口是没有登录的,怎么样能让他保持登录啊?大概代码如下,求高人解决,由于是个新号,没有可以给的,支持现金,如果能帮忙解决这问题的,愿意给一定的钱,直接给你线上转账!

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate("xxxx.com")
    End Sub
    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        RemoveHandler Me.WebBrowser1.Document.Window.Unload, AddressOf Window_Unload
        AddHandler Me.WebBrowser1.Document.Window.Unload, AddressOf Window_Unload
    End Sub

    Private Sub Window_Unload(ByVal sender As Object, ByVal e As HtmlElementEventArgs)
        If Me.WebBrowser1.Document Is Nothing Then
            Me.Close()      
        End If
    End Sub

  
End Class
webbrowser session 浏览器 --------------------编程问答-------------------- 求高人回答! --------------------编程问答-------------------- 我也遇到同样问题,帮顶 --------------------编程问答-------------------- 遇到同样的问题,兄弟你解决了没,在网上看到这么个例子,没用明白,可以一起讨论下。
public Form1()         {             InitializeComponent();            this.webBrowser1.AllowWebBrowserDrop = false;  //可在属性里设置,很重要            //在新Form中的WebBrowser中打开             (this.webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).NewWindow2 += new SHDocVw.DWebBrowserEvents2_NewWindow2EventHandler(Form1_NewWindow2);            //在主WebBrowser中打开            //(this.webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).NewWindow3 += new SHDocVw.DWebBrowserEvents2_NewWindow3EventHandler(Form1_NewWindow3);         }        void Form1_NewWindow2(ref object ppDisp, ref bool Cancel)    {      Form5 frm = new Form5(); //事先建好一个带WebBrowser的窗体      ppDisp = frm.webBrowser1.ActiveXInstance;      frm.Show();    }        void Form1_NewWindow3(ref object ppDisp, ref bool Cancel, uint dwFlags, string bstrUrlContext, string bstrUrl)         {             Cancel = true;            this.webBrowser1.Navigate(bstrUrl);         } --------------------编程问答-------------------- 多次看到人问这个问题。但奇怪的是,我在我的程序中打开新的web窗口,仍然是登陆状态,并不存在需要重新登陆的问题。

说个思路,把cookie传给新窗口,应该可以解决。或者在新窗口中改cookie,然后刷新。以前搞cookie欺骗,经常这样做。是成功的。

补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,