Answer the question
In order to leave comments, you need to log in
How to get response after POST request?
System.Net.WebRequest reqPOST = System.Net.WebRequest.Create(@"http://site.ru/send.php");
reqPOST.Method = "POST";
reqPOST.Timeout = 120000;
reqPOST.ContentType = "application/x-www-form-urlencoded";
byte[] sentData = Encoding.GetEncoding(1251).GetBytes("message=" + System.Web.HttpUtility.UrlEncode("отправляемые данные", Encoding.GetEncoding(1251)));
reqPOST.ContentLength = sentData.Length;
System.IO.Stream sendStream = reqPOST.GetRequestStream();
sendStream.Write(sentData, 0, sentData.Length);
sendStream.Close();
System.Net.WebResponse result = reqPOST.GetResponse();
Answer the question
In order to leave comments, you need to log in
To subtract the answer:
using (Stream stream = result.GetResponseStream())
{
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
String responseString = reader.ReadToEnd();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question