日期:2014-05-18 浏览次数:20846 次
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://192.168.0.200/index2.html"); try { HttpWebResponse respon = (HttpWebResponse)myReq.GetResponse(); } catch (WebException ex) { HttpWebResponse res = (HttpWebResponse)ex.Response; Stream rs = res.GetResponseStream(); Encoding encode = Encoding.GetEncoding("utf-8"); StreamReader readStream = new StreamReader(rs, encode); string tmp = readStream.ReadToEnd(); res.Close(); readStream.Close(); MessageBox.Show(tmp); }