我正在编写一个.NET应用程序,它需要向另一个.NET应用程序发送数据。 我使用以下代码请求登录页面
WebProxy proxy = new WebProxy("http://proxy:80/", true);
HttpWebRequest webRequest = WebRequest.Create(LOGIN_URL) as HttpWebRequest;
//proxy.Credentials = new NetworkCredential("myusername", "mypassword", "domain");
// webRequest.Proxy = proxy;
webRequest.Proxy = WebRequest.DefaultWebProxy;
StreamReader responseReader = new StreamReader
(webRequest.GetResponse().GetResponseStream());
string responseData = responseReader.ReadToEnd();
但是它在这一行出错了
StreamReader responseReader = new StreamReader
(webRequest.GetResponse().GetResponseStream());
伴随着错误消息:
System.Net.WebException: The underlying connection was closed: The connection was
closed unexpectedly.