Set the BaseAddress for WebClient

image_pdfimage_print
   


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);

    }
}

           
          


This entry was posted in C# Network. Bookmark the permalink.