WebClient.DownloadData : WebClient « System.Net « C# / C Sharp by API






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

1.WebClient.BaseAddress
2.WebClient.Credentials
3.WebClient.DownloadFile
4.WebClient.DownloadString(Uri u)
5.WebClient.Headers
6.WebClient.OpenRead(String url)
7.WebClient.OpenWrite
8.WebClient.ResponseHeaders
9.WebClient.UploadData
10.WebClient.UploadValues