How to dump ASP.NET Request headers to string
- by FreshCode
I'd like to email myself a quick dump of a GET request's headers for debugging. I used to be able to do this in classic ASP simply with the Request object, but Request.ToString() doesn't work. And the following code returned an empty string:
using (StreamReader reader = new StreamReader(Request.InputStream))
{
string requestHeaders = reader.ReadToEnd();
// ...
// send requestHeaders here
}