Hello! I'm using the *HttpWebRequest *to do a PUT on my server. The web-server is Node.js. The code is very by the book standard stuff:
// Prepare the data. var dataText = data.ToString(); var byteArray = dataText.ToByteArray(); // Setup the web-request. var req = WebRequest.Create(url); req.Method = "PUT"; req.ContentType = "Content-Type: application/json; charset=utf-8"; req.ContentLength = byteArray.Length; // Process the stream. var dataStream = req.*GetRequestStream*(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); The problem is, when I call *GetRequestStream* it issues the request to the server and the response is complete before the next line (dataStream.Write) executes. As a result no data is actually sent. It's like the stream prematurely flushes upon creation. In fact, I didn't think it was supposed to call the server at all until *GetResponse* was invoked. Am I doing something dumb here? Or, is it something with the way Node is behaving (that would be weird if it were). Or is HttpWebRequest flakey? This works if I use *WebClient*. But I need HttpStatus codes - and my understanding is you can't get at those from *WebClient*. (If you can, I can't find them anywhere! :-)) Anyone else seeing weirdness with *HttpWebRequest*? -- *Phil *Cockfield
_______________________________________________ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch