C#make wget request

Ign*_*nas 0 c# wget

我有这个wget请求:

wget --http-user="user" --http-passwd="password"
www.example.com
Run Code Online (Sandbox Code Playgroud)

在http请求中我写了url地址,但我不知道在哪里放入登录iformation.谢谢

Mar*_*ell 6

怎么样:

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