Access the Internet : HttpWebRequest : Network C# Examples


C# Examples » Network » HttpWebRequest »

 

Access the Internet









    
using  System;  
using  System.Net;  
using  System.IO;  
  
class  MainClass  {    
    public  static  void  Main()  {  
        int  ch;  
  
        HttpWebRequest  req  =  (HttpWebRequest)  WebRequest.Create("http://www.navioo.com");  
  
        HttpWebResponse  resp  =  (HttpWebResponse)  req.GetResponse();  
  
        Stream  istrm  =  resp.GetResponseStream();  
  
        for(int  i=1;  ;  i++)  {  
            ch  =    istrm.ReadByte();  
            if(ch  ==  -1)  
                  break;  
            Console.Write((char)  ch);  
        }  
  
        resp.Close();  
    }  
}
    
   
  
   



Output


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


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Network
» HttpWebRequest