C# 下载网页并在控制台输出
using System; using System.Net; using System.Text; using System.IO; namespace Test { class GetWebPage { public static void Main(string[] args) { for(int i=0;ilt;args.Length;i++) { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(args[i]); HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); Stream stream = httpWebResponse.GetResponseStream(); StreamReader streamReader = new StreamReader(stream, Encoding.ASCII); Console.WriteLine(streamReader.ReadToEnd()); } Console.Read(); } } }