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.
nafiseh salmani4 pointsPosted May 27, 2006, 12:48 AM EDT
u must add a com componenent named "web browser" in win app. , and use navigate method for binding a URL on it .
k john17 pointsPosted May 29, 2006, 1:19 AM EDT
there is no web browser control on com compenents of a windows application. Where i can get that control.
Darren Marshall17 pointsPosted May 29, 2006, 8:51 PM EDT
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; }