Users Online

We have 195 guests online
c# HTTP Request Reader Sample PDF Print E-mail
Written by Zack MIlls   
Thursday, 30 September 2010 10:20

Connect to Web site and read contents in c#

 

 

HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(URL);
myRequest.Method = "GET";
WebResponse myResponse = myRequest.GetResponse();
StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
string result = sr.ReadToEnd();
sr.Close();
myResponse.Close();