- public string GetStr(string url)
- {
-
- WebRequest request = WebRequest.Create(url);
- request.Credentials = CredentialCache.DefaultCredentials;
- HttpWebResponse response = (HttpWebResponse)request.GetResponse();
- Stream dataStream = response.GetResponseStream();
- StreamReader reader = new StreamReader(dataStream, Encoding.UTF8);
- string responseFromServer = reader.ReadToEnd();
- reader.Close();
- dataStream.Close();
- response.Close();
- return responseFromServer;
- }
复制代码 |