C# WebClient DownloadString(String)

Description

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

Syntax

WebClient.DownloadString(String) has the following syntax.


public string DownloadString(
  string address
)

Parameters

WebClient.DownloadString(String) has the following parameters.

  • address - A String containing the URI to download.

Returns

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

Example


using System;//from  w w  w .  java  2 s.  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);
    
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Net »




Cookie
Dns
IPAddress
IPEndPoint
IPHostEntry
WebClient