Hi,
Any sites from which I can learn on how to connect to a site using C# and fetch info from it.
AK
Hi,
Any sites from which I can learn on how to connect to a site using C# and fetch info from it.
AK
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Darren MarshallPosted May 30, 2006, 12:51 AM
private
string myURL = "http://www.c-sharpcorner.com"; public bool GetFromURL(){
// Create a 'WebRequest' object with the specified url. WebRequest myWebRequest = WebRequest.Create(myURL);myWebRequest.Timeout = 10000;
// Send the 'WebRequest' and wait for response. try{
WebResponse myWebResponse = myWebRequest.GetResponse(); // Obtain a 'Stream' object associated with the response object. Stream ReceiveStream = myWebResponse.GetResponseStream(); // Encoding format. Encoding encode = System.Text.Encoding.GetEncoding("utf-8"); // Pipe the stream to a higher level stream reader with the required encoding format. StreamReader readStream = new StreamReader(ReceiveStream, encode); while (string line = readStream.ReadLine()){
// do something with line;
}
readStream.Close();
// Release the resources of response object.myWebResponse.Close();
}
catch (WebException) { } return true;}
k johnPosted May 29, 2006, 5:19 AM
there is no web browser control on com compenents of a windows application. Where i can get that control.
nafiseh salmaniPosted May 27, 2006, 4:48 AM
u must add a com componenent named "web browser" in win app. , and use navigate method for binding a URL on it .