使用ASP.NET代码抓取远程网页的源码:
WebClient wc = new WebClient(); wc.Credentials = CredentialCache.DefaultCredentials; //网页编码格式 Encoding encoding = Encoding.UTF8; //抓取的网页地址 string url = "http://m.weather.com.cn/data/101280105.html"; Byte[] data = wc.DownloadData(url); //最终获取网页源代码字符串 string result = encoding.GetString(data);