Ignas
Ignas

Reputation: 315

C# make wget request

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

Upvotes: 1

Views: 6241

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1062995

How about:

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

?

Upvotes: 7

Related Questions