Joan Venge Joan Venge -4 years ago 276
C# Question

How to convert WebResponse.GetResponseStream return into a string?

I see many examples but all of them read them into byte arrays or 256 chars at a time, slowly. Why?

Is it not advisable to just convert the resulting

value into a string where I can parse it?

Answer Source

You should create a StreamReader around the stream, then call ReadToEnd.

You should consider calling WebClient.DownloadString instead.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download