Basic WebClient

image_pdfimage_print
   



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;

public class MainClass {
    public static void Main() {
        System.Net.WebClient Client = new WebClient();
        Stream strm = Client.OpenRead("http://www.reuters.com");
        StreamReader sr = new StreamReader(strm);
        string line;
        while ((line = sr.ReadLine()) != null) {
            Console.WriteLine(line);
        }
        strm.Close();
    }
}
           
          


This entry was posted in C# Network. Bookmark the permalink.