令狐不聪 通过本文主要向大家介绍了c#实现http,c#http请求,c#http通信,c#http服务器,c#调用http接口等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
本文实例讲述了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.weikejianghu.com"); WebResponse resp = req.GetResponse(); StreamReader reader = new StreamReader(resp.GetResponseStream(),Encoding.ASCII); Console.WriteLine(reader.ReadToEnd()); } } }</div>
希望本文所述对大家的C#程序设计有所帮助。
</div>