I am unable to download images from an RSS Feed, where the URL doesn't contain a filename.
Example -
Image URL I would like to download (it works if you click on it in a browser, but in code it doesn't work):
http://www.deviantart.com/download/286471805/
Using the code below I get a "An exception occurred during a WebClient request." error. I have no idea why this isn't working.
Any ideas on how I can save these files?
private void Start_Button_Click(object sender, EventArgs e)
{
WebClient MyDownloader = new WebClient();
MyDownloader.DownloadFile(@"http://www.deviantart.com/download/286471805/", @"c:\test\");
}
You have to specify a file name as the second argument, not the download directory:
using (var client = new WebClient())
{
client.DownloadFile("http://www.deviantart.com/download/174633066/",
@"c:\test\file.png");
} ↑
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.