那就不用webbrowser控件,直接取网页内容。查:asp.net 抓网页
.net  采集

解决方案 »

  1.   

    那你还不如直接用SqlDataReader抓取数据库信息
      

  2.   

    功能是.打开网站.输入邮件号码.
    点查询..我要的是邮件的信息啊webBrowser1 = new WebBrowser();
                    richtextBox = new RichTextBox();
                    richtextBox.Text = richTextBox1.Text = "";
                    webBrowser1.Navigate("http://www.ems.com.cn/");
                    while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
                    {
                        Application.DoEvents();
                        System.Threading.Thread.Sleep(500);
                    }
                    HtmlElement txt = webBrowser1.Document.All["mailNum"];
                    txt.SetAttribute("value", "邮件号码");
                    HtmlElement btn = webBrowser1.Document.All["btchaxun_r1_c2"];
                    btn.InvokeMember("Click");
                    while (webBrowser1.Url.ToString().IndexOf("qcgzOutQueryAction.do") < 0)
                    {
                        Application.DoEvents();
                    }
                    while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
                    {
                        Application.DoEvents();
                    }
    可是这样很慢啊.我就想快点
      

  3.   

    吼吼,只与IE设置有关,IE选项,高级,多媒体,里面有个下载图片的选项
    可以找找这个的注册表怎么改
      

  4.   

    msdn2.microsoft.com/en-us/library/aa770041(VS.85).aspx 
      

  5.   

    先用INet或 HttpWebRequest先得到HTML然后更改
    WebBrower的Document.Body这样就可以只显示HTML但是CSS等也不会加载了
      

  6.   

    如果只是想访问一次的话HttpWebRequest就可以了
      

  7.   

    采集的相关技术里包括提交表单,但是验证码问题没有完美的解决方法,
    如提交表单不需要验证码,则不需要webbrowser控件实现。另外,如果需要人输入验证码,那么去掉网页图片好象问题会更多。
      

  8.   


    //很久以前寫的一個類,你參考一下。因為現在用的是繁體系統,所以注釋統統亂碼。
    #region Post杅擂濬class Postdate
    ///<summary>
    ///Post杅擂濬
    ///</summary>

    public class Postdate
    {
    private string sPostDate;
    /// <summary>
    /// 枑蝠杅擂
    /// </summary>
    public string PostDate_String
    {
    get
    {
    return sPostDate;
    }
    set
    {
    sPostDate=value;
    }
    }
    private string sPostUrl;
    /// <summary>
    /// 枑蝠華硊
    /// </summary>
    public string postUrl
    {
    get
    {
    return sPostUrl;
    }
    set
    {
    sPostUrl=value;
    }
    }
    private CookieContainer sSessionId;
    /// <summary>
    /// Cookies梓祩
    /// </summary>
    public CookieContainer SessionId
    {
    get
    {
    return sSessionId;
    }
    set
    {
    sSessionId=value;
    }
    }
    private string sReturnString;
    /// <summary>
    /// 殿隙趼睫揹
    /// </summary>
    /// <returns></returns>
    public string ReturnString
    {
    get
    {
    return sReturnString;
    }
    set
    {
    sReturnString=value;
    }
    }

    public void Send()
    {
    //ASCIIEncoding encoding=new ASCIIEncoding();
    //try
    //{
    UTF8Encoding encoding=new UTF8Encoding();
    byte[]  byte1=encoding.GetBytes(sPostDate);
    HttpWebRequest request = (HttpWebRequest) WebRequest.Create(sPostUrl);
    request.CookieContainer=sSessionId;
    //request.AllowAutoRedirect=true;
    request.Method="POST";
    request.Accept="*.*";
    /*if (sProxy!=""||sProxy.Length!=0)
    {
    string[] aProxy;
    aProxy=sProxy.Split(':');
    WebProxy p=new WebProxy(aProxy[0],Convert.ToInt32(aProxy[1]));
    request.Proxy=p;
    }*/
    /*WebProxy p=new WebProxy("12.108.52.196",3128);
    request.Proxy=p;*/
    request.Referer="來路地址";
    request.ContentLength=sPostDate.Length;
    request.ContentType="application/x-www-form-urlencoded";
    request.ServicePoint.Expect100Continue = false;
    Stream newStream=request.GetRequestStream();
    newStream.Write(byte1,0,byte1.Length);
    //request.get
    request.Timeout=30000;
    HttpWebResponse response = (HttpWebResponse) request.GetResponse(); 
    byte[] buf = new byte[46000]; 
    string xx=response.StatusCode + "//" + response.StatusDescription;
    Stream resStream = response.GetResponseStream(); 
    //resStream.Write(byte1,0,byte1.Length);
    int count = resStream.Read(buf, 0, buf.Length); 
    sReturnString=Encoding.Default.GetString(buf,0,count); 
    resStream.Close(); 
    newStream.Close();
    //}
    //catch(Exception ex)
    //{
    // MessageBox.Show(null,ex.Message,"渣昫");
    //}
    }
    }
    #endregion
      

  9.   

    我想往一个文本框里添字符串
    如"EC244622097CN"
    应该怎么改呢
      

  10.   

    你指的是要post到服務器上的內容吧?把那些內容串起來賦值給PostDate_String這個屬性
      

  11.   


    //調用例子,用戶名(name)=我穿牆而過,密碼(password)=123456提交到http://www.csdn.net。注意中文字符要先編碼
    Postdate oPostdate=new Postdate();
    oPostdate.SessionId=MopooCookies;
    oPostdate.postUrl="http://www.csdn.net";
    oPostdate.PostDate_String="name=" + System.Web.HttpUtility.UrlEncode("我穿牆而過",System.Text.Encoding.GetEncoding("GB2312")) + "&password=123456";
    oPostdate.Send();
      

  12.   

    错误 1 找不到类型或命名空间名称“Postdate”(是否缺少 using 指令或程序集引用?) C:\Documents and Settings\Administrator\桌面\rrrrr\WindowsApplication1\WindowsApplication1\Form1.cs 72 13 WindowsApplication1
    错误 4 命名空间“System.Web”中不存在类型或命名空间名称“HttpUtility”(是缺少程序集引用吗?) C:\Documents and Settings\Administrator\桌面\rrrrr\WindowsApplication1\WindowsApplication1\Form1.cs 75 62 WindowsApplication1
      

  13.   

    利用MSHTML,在NAVIGATECOMPLETE2事件中,后DOCUMENTCOMPLETE事件中把HTML代码全部拿出来,把IMG的结点全部隐藏,而且把FLASH的的结点也隐藏,就应该可以了。 
    dim element as ihtmlelement 
    element.style.visible="hidden" 
    主要就是上面那句了。别的你再自己想想吧。用BHO可以的var   TempHtmlFile:   String;   
      begin   
       EditURL.Text   :=   'http://www.yahoo.com';    
          TempHtmlFile   :=   ExtractFilePath   (Application.ExeName)   +   'temp1.html';   
          Memo1.Lines.Text   :=   IdHTTP.Get(   EditURL.Text   );   
          Memo1.Lines.SaveToFile(   TempHtmlFile   );   
          WebBrowser1.Navigate(   TempHtmlFile   );   
      end;   
        
      (注:此方法可不下载图片、可是有图片的地方怎麼処理?重新排版?)