string postData = "post string";
byte[] data = Encoding.ASCII.GetBytes(postData);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://122.233.155.155:80");
req.Method = "POST";
req.ContentLength = postData.Length;
req.Timeout = 10000;
using (Stream stream = req.GetRequestStream()) stream.Write(data, 0, data.Length);
using (HttpWebResponse response = (HttpWebResponse)req.GetResponse())
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.ASCII))
{
string s = reader.ReadToEnd();
Console.WriteLine(s);
}
Так получаю ответ в виде string, а как получить в виде массива байтов byte[] ?