Skip to content

Instantly share code, notes, and snippets.

@kzelda
Forked from leggetter/gist:769688
Created September 24, 2019 10:53
Show Gist options
  • Save kzelda/4fc3d3ac37f4b53a29c14f022cc6b3d7 to your computer and use it in GitHub Desktop.
Save kzelda/4fc3d3ac37f4b53a29c14f022cc6b3d7 to your computer and use it in GitHub Desktop.
How to get the body of a HTTP Request using C#
private string GetDocumentContents(System.Web.HttpRequestBase Request)
{
string documentContents;
using (Stream receiveStream = Request.InputStream)
{
using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
{
documentContents = readStream.ReadToEnd();
}
}
return documentContents;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment