Thanks for the response... Since posting, I've come across the fact
that the ToString method of the Headers property is overloaded and
returns the headers - except for the first line. So, what I end up
doing is building that first line manually, then appending the rest:

sHeaders = "HTTP/" & oResponse.ProtocolVersion.ToString
sHeaders += " " & oResponse.StatusCode
sHeaders += " " & oResponse.StatusDescription & ControlChars.CrLf
sHeaders += oResponse.Headers.ToString

Not the prettiest way I've ever seen, but it works... At least for
now...

> -----Original Message-----
> From: dotnet discussion
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Deepak Rao
> Sent: Sunday, April 14, 2002 18:32
> To: [EMAIL PROTECTED]
> Subject: Re: HttpWebReqponse - raw headers?
>
>
> If you just need to know what the headers are, then try this
>
> HttpWebRequest myHttpWebRequest =
> (HttpWebRequest)WebRequest.Create("http://localhost/";);
>
> HttpWebResponse myHttpWebResponse =
> (HttpWebResponse)myHttpWebRequest.GetResponse();
>
> for(int i=0; i < myHttpWebResponse.Headers.Count; ++i)
>    Console.WriteLine("\nHeader Name:{0},
> Value:{1}",myHttpWebResponse.Headers.Keys[i],myHttpWebRespon
> se.Headers[i
> ]);
>
> myHttpWebResponse.Close();
>
> Deepak
>
> > -----Original Message-----
> > From: dotnet discussion
[mailto:[EMAIL PROTECTED]] On Behalf
Of
> Tracy Martin
> Sent: Sunday, April 14, 2002 11:52 AM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] HttpWebReqponse - raw headers?
>
> Greetings,
>
> I'm playing with HttpWebRequest and HttpWebResponse, and I can't
seem
> to find a way to get the raw header stream. I thought perhaps
> GetResponseStream, but that returns the actual internet resource,
not
> the headers.
>
> I want to be able to log the raw headers for certain retrievals -
and
> I'd rather not resort to having to write this using Sockets...
>
> Any ideas?
>
> Tracy
>
> You can read messages from the DOTNET archive, unsubscribe from
DOTNET, or
> subscribe to other DevelopMentor lists at
http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to