Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Capture HTTP request
private string GetRequest()
var headers = String.Empty;
StringBuilder sb = new StringBuilder();
sb.AppendLine("URL: " + Context.Request.Url);
sb.AppendLine("IP address:" + Context.Request.UserHostAddress);
sb.AppendLine("HttpMethod " + Request.HttpMethod);
foreach (var key in Request.Headers.AllKeys)
sb.AppendLine(key + "=" + Request.Headers[key]);
return sb;
private string GetDocumentContents(System.Web.HttpRequest Request)
var httpRequestBase = new HttpRequestWrapper(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
You can’t perform that action at this time.