HttpWebRequest和WebBrowser共享session

解决方案 »

  1.   

    基本做不到,还是死心吧。。特别是从webbrowser到httpwebrequest,更是难.....
      

  2.   

    你看看吧
    http://topic.csdn.net/u/20080701/00/40c8194f-1046-46df-ac46-8e6fcf7122b2.html
    http://www.google.cn/search?hl=zh-CN&source=hp&q=HttpWebRequest%E5%92%8CWebBrowser%E5%85%B1%E4%BA%ABsession&btnG=Google+%E6%90%9C%E7%B4%A2&aq=f&oq=
      

  3.   

    可用cookie
    CookieContainer   myCookieContainer   =   new   CookieContainer(); 
    string   cookieStr   =   webBrowser1.Document.Cookie;
    string[]   cookstr   =   cookieStr.Split( '; '); 
    foreach   (string   str   in   cookstr) 
    { } 
    HttpWebRequest   hreq=(HttpWebRequest)HttpWebRequest.Create(""); 
    hreq.Method= "POST "; 
    hreq.ContentType= "application/x-www-form-urlencoded "; 
    hreq.CookieContainer= myCookieContainer;