C# WebClient DownloadString(Uri)

Description

WebClient DownloadString(Uri) Downloads the requested resource as a String. The resource to download is specified as a Uri.

Syntax

WebClient.DownloadString(Uri) has the following syntax.


public string DownloadString(
  Uri address
)

Parameters

WebClient.DownloadString(Uri) has the following parameters.

  • address - A Uri object containing the URI to download.

Returns

WebClient.DownloadString(Uri) method returns A String containing the requested resource.

Example


//w w  w.  j a v  a  2  s.  c  om
using System;
using System.Net;
using System.Net.Sockets;

public class Example
{
   public static void Main()
   {
        WebClient client = new WebClient ();
        string reply = client.DownloadString (new Uri("http://www.java2s.com"));

        Console.WriteLine (reply);
    
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Net »




Cookie
Dns
IPAddress
IPEndPoint
IPHostEntry
WebClient