Created
August 12, 2012 13:26
-
-
Save philcockfield/3331798 to your computer and use it in GitHub Desktop.
WebRequest Premature call to Server (Node).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. | |
Stream dataStream = req.GetRequestStream(); | |
dataStream.Write(byteArray, 0, byteArray.Length); | |
dataStream.Close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment