Request取得这个网页的代码,
再查找就OK了。

解决方案 »

  1.   

    抓取网页html源文件
    <%@ Page language="C#" Trace="True" %>
    <%@ Import Namespace="System.Net" %>
    <%@ Import Namespace="System.IO" %><html>
    <head>
     <SCRIPT runat="server">
      void Page_Load(Object sender, EventArgs e) {    WebRequest req = WebRequest.Create("http://www.im286.com/index.php");
    string urliii="src="; //图片使用绝对连接
    urliii+="http://www.im286.com/";
        try {
            WebResponse result = req.GetResponse();
            Stream ReceiveStream = result.GetResponseStream();        Byte[] read = new Byte[512];
            int bytes = ReceiveStream.Read(read, 0, 512);        lblHTML.Text = "";
            while (bytes > 0)
            {          // 注意:
              // 下面假定响应使用 gb2312 作为编码方式。
              // 如果内容以 ANSI 代码页形式(例如,932)发送,则使用类似下面的语句:
              //Encoding encode = System.Text.Encoding.GetEncoding("shift-jis");
              Encoding encode = System.Text.Encoding.GetEncoding("gb2312");
              lblHTML.Text = lblHTML.Text + encode.GetString(read, 0, bytes);
      
              bytes = ReceiveStream.Read(read, 0, 512);
      
            }
        } catch(Exception) {
            lblHTML.Text = "检索页时出错";
        }
    lblHTML.Text = lblHTML.Text.Replace("src=",""+urliii+"");
    lblHTML.Text = lblHTML.Text.Replace("\"","");
      }
    </SCRIPT>
    </head><body>  <form method="post" action="Webrequest.aspx" runat="server">
        
        <asp:Label runat=server ID="lblHTML" Rows="30" Cols="80" EnableViewState="false"  Wrap="True"></asp:Label>
      </form></body>
    </html>
      

  2.   

    这个是我抓Tom 2004 奥运金牌榜的代码
    演示
    http://www.aspxboy.com/jp/default.aspx<%@ Page language="C#"%>
    <%@ Import Namespace="System.Net" %>
    <%@ Import Namespace="System.IO" %>
    <html>
    <head>
    <title> 2004奥运奖牌榜 </title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <meta name="title" content="" />
    <meta name="author" content="活靶子,Huobazi,www.AspxBoy.com" />
    <meta name="subject" content="" />
    <meta name="language" content="gb2312" />
    <meta name="keywords" content="" />
    <meta name="Copyright" content="www.AspxBoy.com" />
    <meta name="robots" content="all" />
    <style type="text/css">
    <!--
    A:active {
    TEXT-DECORATION: none
    }
    A:hover {
    TEXT-DECORATION: underline
    }
    A:link {
    TEXT-DECORATION: none
    }
    table{
    border-widht:1px;
    border-color:navy;
    }
    BODY {
    FONT-SIZE: 9pt; FONT-FAMILY: 宋体;
    SCROLLBAR-HIGHLIGHT-COLOR: buttonface; 
    SCROLLBAR-SHADOW-COLOR: buttonface;
    SCROLLBAR-3DLIGHT-COLOR: buttonhighlight;
    SCROLLBAR-TRACK-COLOR: #eeeeee;
    SCROLLBAR-DARKSHADOW-COLOR: buttonshadow 
    }
    TD {
    FONT-SIZE: 9pt; FONT-FAMILY: 宋体;
    border-widht:1px;
    border-color:navy;
    }
    DIV {
    FONT-SIZE: 9pt; FONT-FAMILY: 宋体
    }
    BR {
    FONT-SIZE: 9pt; FONT-FAMILY: 宋体
    }-->
    </style>
    <SCRIPT runat="server">
      public string strDisply = "";
      public string GetContentFromUrl(string url)
    { string strResult = "";
    System.Net.WebClient client=new WebClient();
    byte[] page=client.DownloadData(url);
    strResult=System.Text.Encoding.Default.GetString(page);
    return strResult.Replace(Environment.NewLine,""); }
     private string GetJpContent(string content)
    {
    string str="";
    Regex re = new Regex(@"<table width=""98%"" border=""0"" cellspacing=""1"" cellpadding=""2"" align=""center"" bgcolor=""#0066A0"">(?<HtmlCode>.*?)<center><hr width=""750"" size=""1"" noshade>",RegexOptions.IgnoreCase | RegexOptions.Singleline);
    foreach (Match m in re.Matches(content))
    {
    str = m.Groups["HtmlCode"].Value;

    }
    return str;
    }
      public void Page_Load(Object sender, EventArgs e) {
    string strHtml = GetContentFromUrl("http://2004.sports.tom.com/2004/ayjpb/index.html");
    strDisply = GetJpContent(strHtml);
      }
    </SCRIPT>
    </head>
    <body><div id="ss" align="center">
    <H2><BR>
        <font color="#990000">2004奥运奖牌榜</font></H2>
    <table width="80%" border="0">
    <tr>
    <td>
    <%Response.Write(strDisply.Replace(".html",".aspx").Replace(".htm",".aspx"));%>
    <td>
    </tr>
    </table>
    </div></body>
    </html>
      

  3.   

    找到了一个地址:
    http://dotnet.aspx.cc/ShowDetail.aspx?id=0A6660CE-4138-41EF-B882-15DB65564709谢谢诸位。