Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 30th, 2012  |  syntax: None  |  size: 2.65 KB  |  views: 4,480  |  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. using (WebClient client = new WebClient())
  2.      {
  3.          html = client.DownloadString(strUrl);
  4.      }
  5.        
  6. using (WebClient client = new WebClient())
  7.      {
  8.         byte[] DataBuffer = client.DownloadData(strUrl);
  9.         html = Encoding.ASCII.GetString(DataBuffer);
  10.      }
  11.        
  12. WebResponse objResponse;
  13. WebRequest objRequest = System.Net.HttpWebRequest.Create(strUrl);
  14. objResponse = objRequest.GetResponse();
  15. using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
  16. {
  17.    html = sr.ReadToEnd();
  18.    sr.Close();
  19. }
  20.        
  21. <td align="right" style="color:Red;background-color:White;width:4.375em;border-bottom:1px solid black;border-right:1px solid black;">-27.0%</td>
  22.        
  23. <td align="right" bgcolor="White" style="border-bottom:1px solid black;border-right:1px solid black;"><font face="Arial,sans-serif" color="Red">-27.0%</font></td>
  24.        
  25. GET / HTTP/1.1
  26. Connection: keep-alive
  27. Accept: */*
  28. User-Agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11
  29. Accept-Encoding: gzip,deflate,sdch
  30. Accept-Language: en-US,en;q=0.8
  31. Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  32. Cookie: .ASPXBrowserOverride=Mozilla%2f4.0+(compatible%3b+MSIE+6.0%3b+Windows+CE%3b+IEMobile+8.12%3b+MSIEMobile+6.0);
  33.        
  34. Connection: keep-alive
  35. Cache-Control: max-age=0
  36. User-Agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11
  37. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  38. Accept-Encoding: gzip,deflate,sdch
  39. Accept-Language: en-US,en;q=0.8
  40. Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  41. Cookie: .ASPXBrowserOverride=Mozilla%2f4.0+(compatible%3b+MSIE+6.0%3b+Windows+CE%3b+IEMobile+8.12%3b+MSIEMobile+6.0);
  42.        
  43. {Content-Length: 267123
  44. Cache-Control: private
  45. Content-Type: text/html; charset=utf-8
  46. Date: Tue, 27 Nov 2012 18:37:27 GMT
  47. Set-Cookie: ASP.NET_SessionId=******; path=/; HttpOnly
  48. Server: Microsoft-IIS/7.5
  49. X-AspNet-Version: 4.0.30319
  50. X-Powered-By: ASP.NET
  51. }
  52.        
  53. using (WebClient client = new WebClient())
  54.      {
  55.          client.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11");
  56.          html = client.DownloadString(strUrl);
  57.      }
  58.        
  59. webClient.Headers.Add("user-agent", "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5");
  60. var iphoneHtml = webClient.DownloadString("http://www.yoursite.com");
  61. webClient.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11");
  62. var safariHtml = webClient.DownloadString("http://www.yoursite.com");