>>>会发现当行数超过2046行后,读到的文本不全2046行也不算大,你是怎么读的?用ReadToEnd()了么?把你读的URL写出来http://www.codersource.net/csharp_screen_scraping.html

解决方案 »

  1.   

    用正则表达式吧,<a href=(?<Link>[^ ]+) [^>]*>清华大学</a>
    没经过严格测试,但能符合你这个例子的要求。
      

  2.   

    下面这个正则式解析A标记的,ftp://games:[email protected] 有下载Regex  re  =  new  Regex(@"<[a|img|script|link]\s+[href|src]+=([""'])(?<url>[^'"">]+)\1\s*>(\s*(?<name>[^-\s|(<img\S\s</)]*)\s*-)?\s*(?<song>[^<]+)</",  RegexOptions.IgnoreCase    |  RegexOptions.Singleline);  
    MatchCollection  mc  =  re.Matches(PageStr);  
    foreach  (Match  m  in  mc)  
    {  
    if  (m.Groups["name"].Value  !=  "")  
    this.strFileList.AppendText(m.Groups["name"].Value);  
    else  if  (m.Groups["name"].Captures.Count  >  0)  
      
    this.strFileList.AppendText("未知");
    else 
    strFileList.AppendText("文件名");

    strFileList.AppendText("\t");
    strFileList.AppendText(m.Groups["song"].Value);
    strFileList.AppendText("\t");
    strFileList.AppendText(m.Groups["url"].Value);
    UrlList.Append(m.Groups["url"].Value);
    strFileList.AppendText("\n");

     
                 
    }              
    strFileList.AppendText("遍历URL树:\n");
    UrlList.MoveFrist();
    string url=string.Empty;
    while(!UrlList.IsEof())
    {
    url=UrlList.GetCurrentValue().ToString();
    //strFileList.AppendText(UrlList.GetCurrentValue()+"\n");
    //GetDirPath(url);
    //strFileList.AppendText();
    if(url.IndexOf("/")==-1)
    {
     url=this.UrlAddress.Text+"/"+url;
    }
    if(url.StartsWith("/"))
    {
    url="http://"+Core.GetUrlRootPath(this.UrlAddress.Text)+"/"+url;
    }
    if(url.StartsWith("."))
    {
     url=Core.GetAndNormailizePath(url);
    }
      

  3.   

    to:windinwing(潇笑)
    ftp密码不对啊,进不去,能不能发到我邮箱里
    [email protected],谢谢
      

  4.   

    有专门解析html的parser,下载一个