Mega Code Archive

 
Categories / C# / Network
 

NetworkCredential test

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