C#自帶網路請求 由於偶爾會用到服務端請求,寫下隨筆,以便下次使用 . var Url = "http://rueiqiang.vicp.net/api/Franchisee/QueryInstallOrderAndReturn"; WebRequest wReq = WebRequest.Crea ...
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就是返回值
}