Is there any quicker alternative to the code below to get a http response into a string?
string req = "http://someaddress.com";
Stopwatch timer = new Stopwatch();
timer.Start();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream dataStream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(dataStream);
reader.ReadToEnd();
}
}
timer.Stop();
Console.WriteLine(timer.Elapsed);
The response is pretty big - around 2MB and is in XML format. Affter this codes completes, the timer is equal to ~50 seconds. When I paste the same url into the browser window it takes about 35 seconds for it to display the xml document.