下のソースコードのnvc.addという部分がどうもうまく行ってないようで、エラーが起こってしまいます。
エラーの内容はこちらです![エラーの内容]WIDTH:600
lang
1using System; 2using System.IO; 3using System.Net; 4using System.Text; 5using System.Collections; 6using System.Collections.Specialized; 7 8namespace ConsoleApplication1 9{ 10 public class Program 11 { 12 static void Main() 13 { 14 WebClient wc = new WebClient(); 15 // WebClientEx wc = new WebClientEx(2000); 16 17 NameValueCollection nvc = new NameValueCollection(); 18 19 // パラメータ追加 20 nvc.add("value1", 100); 21 nvc.add("value2", 200); 22 23 // POST 24 byte[] resPost = wc.UploadValues("http://hogehoge.net/hoge/Service", nvc); 25 26 // GET 27 wc.QueryString = nvc; 28 29 byte[] resGet = wc.DownloadData("http://hogehoge.net/hoge/Service"); 30 31 wc.Dispose(); 32 33 string resPostData = System.Text.Encoding.UTF8.GetString(resPost); 34 string resGetData = System.Text.Encoding.UTF8.GetString(resGet); 35 } 36 } 37}
正直全く分かりません。どなたか解決方法のわかる方がいらっしゃったら教えて下さい。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/04/10 02:02