Results 1 to 2 of 2

Thread: How to get data from a web page?

  1. #1
    Join Date
    Mar 2009

    How to get data from a web page?


    I have this problem... Could you recommend me some object or library in .NET (C#) so I could obtain source code (HTML data) of given web page? I need to parse and analyze those data for my project...

    Thanks a lot...

  2. #2
    Join Date
    Jun 2006
    HTML Code:
     HttpWebRequest Req = (HttpWebRequest)WebRequest.Create("http://www.google.com");
            Req.Timeout = 60000;// 1 min
            Req.AllowAutoRedirect = true;
            HttpWebResponse Resp = (HttpWebResponse)Req.GetResponse();
            //// Get the Response Stream
            Stream respStream = Resp.GetResponseStream();
            StreamReader sr = new StreamReader(respStream, Encoding.Default);
            string respHTML = sr.ReadToEnd();
    The string respHTML will now contain the source for www.google.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center