object nullObject = null ;
axWebBrowser1.Navigate("http://bhg.binhai.com",ref nullObject , ref nullObject , ref nullObject , ref nullObject);
mshtml.IHTMLDocument2 myDocument =(mshtml.IHTMLDocument2)axWebBrowser1.Document;
string aa=myDocument.body.innerHTML;//此句出错。
mshtml.HTMLDocument myDocument =(mshtml.HTMLDocument)axWebBrowser1.Document;
也出错。

解决方案 »

  1.   

    axWebBrowser1.Navigate("http://bhg.binhai.com",ref nullObject , ref nullObject , ref nullObject , ref nullObject);
    mshtml.HTMLDocumentClass myDocument =(mshtml.HTMLDocumentClass)axWebBrowser1.Document;
    string aa=myDocument.body.innerTXT;保存此字符串,扩展名改成.htm就可以了
      

  2.   

    try {
        
    // Download the data to a buffer.
           WebClient client = new WebClient();  Byte[] pageData = client.DownloadData("http://www.contoso.com");
    string pageHtml = Encoding.ASCII.GetString(pageData);
    Console.WriteLine(pageHtml);// Download the data to a file.
            client.DownloadFile("http://www.contoso.com", "page.htm");// Upload some form post values.
    NameValueCollection form = new NameValueCollection();        
    form.Add("MyName", "MyValue");        
    Byte[] responseData = client.UploadValues("http://www.contoso.com/form.aspx", form);        }
    catch (WebException webEx) {
          Console.WriteLine(webEx.ToString());
           if(webEx.Status == WebExceptionStatus.ConnectFailure) {
               Console.WriteLine("Are you behind a firewall?  If so, go through the proxy server.");
           }
    }