Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
コードを見てください:
using (var client = new WebClient()) { using (var stream = client.OpenWrite("http://localhost/", "POST")) { stream.Write(post, 0, post.Length); } }
では、HTTP 出力を読み取るにはどうすればよいでしょうか。
byte[]投稿するデータがあるようです。その場合、使いやすいと思います:
byte[]
byte[] response = client.UploadData(address, post);
応答がテキストの場合は、次のようになります。
string s = client.Encoding.GetString(response);
(またはあなたの選択Encoding- おそらくEncoding.UTF8)
Encoding
Encoding.UTF8