Create GetResponse from WebRequest : Web Crawler : Network C# Source Code


Custom Search

C# Source Code » Network » Web Crawler »

 

Create GetResponse from WebRequest








    


using System;
using System.Net;
using System.IO;
using System.Drawing;
using System.Windows.Forms;

public class MainClass {
    public static void Main() {
        string picUri = "http://www.apress.com/img/img05/Hex_RGB4.jpg";
        string htmlUri = "http://www.apress.com";

        WebRequest requestPic = WebRequest.Create(picUri);
        WebRequest requestHtml = WebRequest.Create(htmlUri);

        WebResponse responsePic = requestPic.GetResponse();
        WebResponse responseHtml = requestHtml.GetResponse();

        Image img = Image.FromStream(responsePic.GetResponseStream());

        using (StreamReader r = new StreamReader(responseHtml.GetResponseStream())) {
            Console.WriteLine(r.ReadToEnd());
        }
    }
}
           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Network
» Web Crawler