Skip to content

Instantly share code, notes, and snippets.

@smoak
Created October 18, 2011 20:22
Show Gist options
  • Save smoak/1296599 to your computer and use it in GitHub Desktop.
Save smoak/1296599 to your computer and use it in GitHub Desktop.
var request = (HttpWebRequest)WebRequest.Create(this.Url);
request.Accept = "application/json";
request.ContentType = "application/json";
request.Method = "POST";
using (var writer = new StreamWriter(request.GetRequestStream()))
{
writer.Write(this.PostBody);
}
var response = request.GetResponse();
string responseString = null;
using(var stream = response.GetResponseStream())
{
using(var reader = new StreamReader(stream))
{
responseString = reader.ReadToEnd();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment