私は、特に Web の側面において、C# に比較的慣れていません。
私が次のものを持っているとしましょう:
string URI = "http://www.domain.com/post.php";
string params = "param1=value1¶m2=value2¶m3=value3";
次のようなデータを投稿できることを理解しています。
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string HtmlResult = wc.UploadString(URI, params);
}
しかし、このデータを投稿するときにプロキシを使用するにはどうすればよいでしょうか?
この関連リンクを見つけました:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URI);
WebProxy myproxy = new WebProxy("1.1.1.1", 80);
myproxy.BypassProxyOnLocal = false;
request.Proxy = myproxy;
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse) request.GetResponse();