Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 0.31 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Downloading file using C# HTTP GET
  2. WebClient client = new WebClient ();
  3. client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
  4.        
  5. WebClient webClient = new WebClient();
  6. Stream stream = webClient.OpenRead("www.mypage.com");
  7. String request = stream.ReadToEnd();