Use WebClient to read the contents of a webpage to a string

By [)ia6l0 iii

You can read the contents of a web page into a string using the WebClient class.

The sample code is as follows:

using System.Net;

string pageUrl = ""http://www.eggheadcafe.com"";

WebClient sampleWebClient = new WebClient();

string result = sampleWebClient.DownloadString(pageUrl);

Related FAQs

Use the "IsSecureConnection" property of the HttpRequest object to find if a Request is from a HTTP or HTTPS connection
Use the Proxy property of the Http Web Request to specify proxy.
Use the WebClient class from System.Net namespace to download and save a file.
Use the Credentials property of the Http Web Request to specify Credentials.
There is a limit to the number of concurrent calls that you can make to a webserver. This is a bottleneck.
Use the System.Net.WebClient class to download a file with credentials.
Use WebClient to read the contents of a webpage to a string  (979 Views)