For POST requests using HttpWebRequest, when I write to the request stream, at what point is the data sent? Is this when I close the request stream or when I call GetResponse? Is a GetResponse call required?
The .net documentation does not seem to be very clear what is actually happening.
Here is the code that interests me:
HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest; request.Method = "POST"; request.ContentLength = jsonData.Length; request.ContentType = "application/json"; Stream requestStream = request.GetRequestStream(); requestStream.Write(jsonData, 0, jsonData.Length); requestStream.Close(); var response = request.GetResponse() as HttpWebResponse;
Thanks!
rysama
source share