Hey, I'm trying to download a file from the internet and save it to my desktop.. The code compiles but at runtime it does not download the file:

try
 {
     WebClient fileDownloader = new WebClient();
     fileDownloader.DownloadFile("http://www.google.com/logos/2010/lebanonind10-hp.jpg", "/Users/p/Desktop");
}
catch(Exception ex)
{
   Console.WriteLine ("The file cannot be downloaded!");
}

Any ideas please? Thanks :)

Make sure to give it a name and extension

To expand on what Cale said, the second parameter must be a filename, not a directory (though it can include a directory).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.