プログラムをプロキシ経由で動作させようとしていますが、動作させたくありません (System.Net.WebException: The operation has timed out)。プロキシがなければすべて問題ありません
コードは次のとおりです。
string proxy = "154.46.33.157";
int port = 8080;
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "email=" + email + "&pass=" + pass;
byte[] data = encoding.GetBytes(postData);
WebProxy myproxy = new WebProxy(proxy, port);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("SITE");
WebHeaderCollection myWebHeaderCollection = request.Headers;
request.CookieContainer = sCookie;
request.Method = "POST";
request.Proxy = myproxy;
request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
request.ContentLength = data.Length;
request.Host = "HOST";
request.UserAgent = "[UA]";
request.Referer = "reffer";
request.KeepAlive = false;
request.Timeout = 20000;
Stream stream = request.GetRequestStream(); // TIMEOUT HERE
stream.Write(data, 0, data.Length);
stream.Close();
request.GetResponse()
.Close();
同時に、このコードはうまく機能します
string proxy = "154.46.33.157";
int port = 8080;
WebProxy myproxy = new WebProxy(proxy, port);
WebRequest req = WebRequest.Create("SITE");
req.Timeout = 5000;
req.GetResponse();
プロキシは生きています。IE でテストしました。修正するにはどうすればよいですか?