How to dump ASP.NET Request headers to string

Posted by FreshCode on Stack Overflow See other posts from Stack Overflow or by FreshCode
Published on 2010-04-13T09:58:20Z Indexed on 2010/04/13 10:02 UTC
Read the original article Hit count: 515

Filed under:
|
|

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
}

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#