我用axWebBrowser做了一个浏览器,并 this.axWebBrowser2.BeforeNavigate2 += new DWebBrowserEvents2_BeforeNavigate2EventHandler(axWebBrowser2_BeforeNavigate2);//记录打开网页前的COOKIE,HTTP头            this.axWebBrowser2.NavigateComplete2 += new DWebBrowserEvents2_NavigateComplete2EventHandler(axWebBrowser2_NavigateComplete2);//记录下载的URL和HTML文件
            并跟HTTPWATCH里记录的做对比,很不一样,"AWSUSER_ID=awsuser_id1206884858627r1897; ASP.NET_SessionId=pbgrfv45fubwufnbepkmho55; SiteSeq=593674717; newt=1; sportid=1",结果少了"ASP.NET_SessionId=pbgrfv45fubwufnbepkmho55";HTTP地址头也不全,得到的HTML文件也是是如此.不知道是什么原因,JS?为什么会这样呢?谁能帮帮忙?

解决方案 »

  1.   

    The ASP.NET session state is process-dependent. Anything that affects the process may cause session state lost. CAUSEWhen you click a hyperlink in an application that is hosting the WebBrowser control, a new page opens in Internet Explorer. In this scenario, the session cookie is lost, and you may have to log on again. This behavior occurs because Internet Explorer is a different process than the application process. A session cookie cannot be shared between processes. SOLUTION
    To maintain the session state in this scenario, you can use the NewWindow2 event to open the new page in another form in the application. This event is triggered by the AxWebBrowser control. Please check this KB article:http://support.microsoft.com/kb/311282/en-usHow to use the WebBrowser control NewWindow2 event in Visual Basic .NET  How to use the AxWebBrowser control?Right-click the ToolBox -> select 'Choose Items ...' -> Select the COM tab -> Select "Microsoft Web Browser"  Then a Microsoft Web Browser control will be added on the toolbox, drag it onto your form. Please check this thread for reference:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2333805&SiteID=1
      

  2.   

     T0 welcomesay :
         但当时情况,并没有产生一个新的WINDOW!
      

  3.   

    你可以去下载一个winpcap来获取session,我也是用这个方法来获取的!