WebClient.DownloadData : WebClient « System.Net « C# / C Sharp by API
- C# / C Sharp by API
- System.Net
- WebClient
WebClient.DownloadData
using System;
using System.Net;
using System.Text;
public class CredTest
{
public static void Main()
{
WebClient wc = new WebClient();
NetworkCredential nc = new NetworkCredential("alex", "mypassword");
wc.Credentials = nc;
byte[] response = wc.DownloadData("http://www.java2s.com/index.htm");
Console.WriteLine(Encoding.ASCII.GetString(response));
}
}
Related examples in the same category