How would I write a script to download files from this site. Is it possible to supply the login and password with the url?
http://feeds.itunes.apple.com/feeds/epf/
Would I format the url like this?
WebClient Client = new WebClient();
Client.DownloadFile("http://feeds.itunes.apple.com/feeds/epf/v3/full/current/itunes20110511.tbz.md5?use开发者_开发百科rname=myusername&password=mypassword", @"C:\folder\file.md5");
Yes, just set the WebClient's
Credentials
property to a NetworkCredentials
instance with the username/password. For example:
Client.Credentials = new System.Net.NetworkCredential("john", "password1234!");
Use WebClient.Credentials property to supply your credentials to the web site:
using (WebClient client = new WebClient()) {
client.Credentials = new NetworkCredential(username, password);
client.DownloadFile("http://feeds.itunes.apple.com/feeds/epf/v3/full/current/itunes20110511.tbz.md5", @"C:\folder\file.md5");
}
精彩评论