Reading Web Pages from a Uri : Uri « Network « C# / CSharp Tutorial






using System;
using System.Net;
using System.IO;
using System.Text;


class MainClass
{
    public static void Main(string[] args)
    {
        Uri uri = new Uri("http://www.java2s.com");
        
        
        WebRequest req = WebRequest.Create(uri);
        WebResponse resp = req.GetResponse();
        Stream stream = resp.GetResponseStream();
        StreamReader sr = new StreamReader(stream);
        
        string s = sr.ReadToEnd();
        
        Console.WriteLine(s);

    }
}


     Java examples (example source code) Organized by topic 

...
...








33.3.Uri
33.3.1.Use Uri
33.3.2.Reading Web Pages from a Uri
33.3.3.Use a regular expression to extract all fully qualified URIs that refer to HTM files