C#自带网络请求
由于偶尔会用到服务端请求,写下随笔,以便下次使用 .
var Url = "http://rueiqiang.vicp.net/api/Franchisee/QueryInstallOrderAndReturn";
WebRequest wReq = WebRequest.Create(Url); WebResponse wResp = wReq.GetResponse(); Stream respStream = wResp.GetResponseStream(); using (StreamReader reader = new StreamReader(respStream, Encoding.GetEncoding("UTF-8")))
{
var result = reader.ReadToEnd(); //result就是返回值
}