C#实现发送简单HTTP请求的方法
摘要:本文实例讲述了C#实现发送简单HTTP请求的方法。分享给大家供大家参考。具体如下:usingSystem;usingSystem.Colle...
本文实例讲述了C#实现发送简单HTTP请求的方法。分享给大家供大家参考。具体如下:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.IO; namespace WRApp { class Program { static void Main(string[] args) { WebRequest req = WebRequest.Create ("http://www.jb51.net"); WebResponse resp = req.GetResponse(); StreamReader reader = new StreamReader(resp.GetResponseStream(),Encoding.ASCII); Console.WriteLine(reader.ReadToEnd()); } } }
希望本文所述对大家的C#程序设计有所帮助。
【C#实现发送简单HTTP请求的方法】相关文章:
★ C#发送HttpPost请求来调用WebService的方法
上一篇:
C#使用List类实现动态变长数组的方法
下一篇:
C#将布尔类型转换成字节数组的方法