1

I have this wget request:

wget --http-user="user" --http-passwd="password"
www.example.com

In http request i wrote url address, but i don't know where to put login iformation. Thank you

Ignas
  • 315
  • 1
  • 8
  • 22
  • possible duplicate of [Using HTTP Authentication with a C# WebRequest](http://stackoverflow.com/questions/707888/using-http-authentication-with-a-c-sharp-webrequest) – Sjoerd Feb 24 '12 at 12:45

1 Answers1

7

How about:

string page;
using(var client = new WebClient()) {
    client.Credentials = new NetworkCredential("user", "password");
    page = client.DownloadString("http://www.example.com/");
}

?

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900