I have a next problem: when I try to create a HttpWebRequest
with proxy, I get a WebException
with the message
The underlying connection was closed: The connection was closed unexpectedly.
What I am doing wrong?
Here is my code:
var webRequest = (HttpWebRequest)WebRequest.Create(@"http://msdn.microsoft.com/");
webRequest.Proxy = new WebProxy("109.254.143.7", 1080);
webRequest.KeepAlive = false;
//webRequest.ProtocolVersion = HttpVersion.Version10;
var myResponse = (HttpWebResponse)webRequest.GetResponse();
var stream = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
var text = stream.ReadToEnd();
P.S.: It happens only when I try to use the proxy.
Thanks in advance!