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.java2java.com/index.htm");
Console.WriteLine(Encoding.ASCII.GetString(response));
}
}
|