C#make wget request

时间:2012-02-24 12:41:53

标签: c# wget

我有这个wget请求:

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

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

1 个答案:

答案 0 :(得分:6)

怎么样:

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