Remove HTTP headers from a raw response

Posted by Ed on Stack Overflow See other posts from Stack Overflow or by Ed
Published on 2010-04-28T14:49:26Z Indexed on 2010/04/28 15:13 UTC
Read the original article Hit count: 369

Filed under:
|
|
|

Let's say we make a request to a URL and get back the raw response, like this:

HTTP/1.1 200 OK
Date: Wed, 28 Apr 2010 14:39:13 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: PREF=ID=e2bca72563dfffcc:TM=1272465553:LM=1272465553:S=ZN2zv8oxlFPT1BJG; expires=Fri, 27-Apr-2012 14:39:13 GMT; path=/; domain=.google.co.uk
Server: gws
X-XSS-Protection: 1; mode=block
Connection: close

<!doctype html><html><head>...</head><body>...</body></html>

What would be the best way to remove the HTTP headers from the response in C#? With regexes? Parsing it into some kind of HTTPResponse object and using only the body?

EDIT:

I'm using SOCKS to make the request, that's why I get the raw response.

© Stack Overflow or respective owner

Related posts about c#

Related posts about httpheader