1. 程式人生 > >C# 網絡請求

C# 網絡請求

bsp ranch toe enc utf 自帶 技術分享 rand his

技術分享

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就是返回值
}


C# 網絡請求