Download the requested resource as a String in CSharp
Description
The following code shows how to download the requested resource as a String.
Example
using System;/*from w w w . j a v a2s . c o m*/
using System.Net;
using System.Net.Sockets;
public class Example
{
public static void Main()
{
WebClient client = new WebClient ();
string reply = client.DownloadString ("http://www.java2s.com");
Console.WriteLine (reply);
reply = client.DownloadString (new Uri("http://www.java2s.com"));
Console.WriteLine (reply);
}
}
The code above generates the following result.