rdsedmundo

HTML Picker

May 2nd, 2012
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Net;
  6. using System.IO;
  7. using System.Windows.Forms;
  8. namespace WindowsFormsApplication1
  9. {
  10.     public partial class Form1 : Form
  11.     {
  12.         public Form1()
  13.         {
  14.             InitializeComponent();
  15.         }
  16.         string getHtml(string url)
  17. {
  18. HttpWebRequest WebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
  19. WebRequest.Method = "GET";
  20. HttpWebResponse myWebResponse = (HttpWebResponse)WebRequest.GetResponse();
  21. StreamReader Source = new StreamReader(myWebResponse.GetResponseStream());
  22. string resp = string.Empty;
  23. resp= Source.ReadToEnd();
  24. myWebResponse.Close();
  25. return resp;
  26.  }
  27.         private void button1_Click(object sender, EventArgs e)
  28.         {
  29.             textBox1.Text = getHtml("http://google.com.br");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment