Set the BaseAddress for WebClient : Web Crawler « Network « C# / C Sharp






Set the BaseAddress for WebClient


using System;
using System.Collections.Generic;
using System.Text;
using System.Net;

class Program {
    static void Main(string[] args) {
        WebClient client = new WebClient();
        client.BaseAddress = "http://www.microsoft.com";
        string data = client.DownloadString("Office");
        Console.WriteLine(data);

    }
}

           
       








Related examples in the same category

1.Build the DownloadString
2.Download a web page in a thread
3.Output webpage content
4.Create GetResponse from WebRequest
5.Check the ContentType
6.MiniCrawler: A skeletal Web crawler