How to Retrieve HTTP content in .NET

HttpWebRequest and HttpWebResponse greatly simplified http content retrial process. Code snippet below demonstrated how easy to use.

using System;
using System.Text;
using System.Net;
using System.IO;
static void Main(string[] args)
    string webUrl = "";
    WebRequest req = WebRequest.Create(webUrl);
    req.Timeout = 10000;
    WebResponse resp = req.GetResponse();
    StreamReader reader = new StreamReader(resp.GetResponseStream(), Encoding.ASCII);
    resp.Close(); // Close the response to free resources.

Simple and elegant. To look for more…Retrieving HTTP content in .NET