🧑💻 提升开发者体验
This commit is contained in:
@@ -12,10 +12,10 @@ namespace GeekDesk.Util
|
||||
ServicePointManager.Expect100Continue = true;
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||
//创建Web访问对 象
|
||||
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
|
||||
WebRequest myRequest = WebRequest.Create(url);
|
||||
myRequest.ContentType = "text/plain; charset=utf-8";
|
||||
//通过Web访问对象获取响应内容
|
||||
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
|
||||
WebResponse myResponse = myRequest.GetResponse();
|
||||
|
||||
//通过响应内容流创建StreamReader对象,因为StreamReader更高级更快
|
||||
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.GetEncoding("utf-8"));
|
||||
|
||||
Reference in New Issue
Block a user