HttpWebRequest简单说明

www.google.cn发一个请求,然后获取该页面的所有代码
HttpWebRequest myReq =(HttpWebRequest)WebRequest.Create("http://www.google.cn/");
    HttpWebResponse response = (HttpWebResponse)myReq.GetResponse();
    Stream receiveStream = response.GetResponseStream ();
    StreamReader rs= new StreamReader (receiveStream, Encoding.UTF8);
    Console.WriteLine(rs.ReadToEnd());

你可能感兴趣的:(request)