Use WebRequest and WebResponse to read a web page : WebRequest : Network C# Examples


C# Examples » Network » WebRequest »

 

Use WebRequest and WebResponse to read a web page









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

public  class  MainClass  {

      [STAThread]
      public  static  void  Main(string[]  args)
      {
              string  htmlUri  =  "http://www.navioo.com";
              WebRequest  requestHtml  =  WebRequest.Create(htmlUri);              
              WebResponse  responseHtml  =  requestHtml.GetResponse();
              //  Read  the  text  from  the  response  stream.
              using  (StreamReader  r  =  new  StreamReader(responseHtml.GetResponseStream()))
              {
                      Console.WriteLine(  r.ReadToEnd());
              }

      }
  
}
    
   
  
   



Output


     Java examples (example source code) Organized by topic 
...
...


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Network
» WebRequest