KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
For POST requests using HttpWebRequest, when I write to a request stream, at what point does the data get sent? Is it when I close the request stream or when I call GetResponse? Is the GetResponse call required? The .net documentation does not seem to be very clear about what is really happening Here's the code I'm curious about: 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!
Tags (comma-separated)
Save Edits
Cancel