James Aharon
James Aharon

Reputation: 223

Why when downloading a the image from the website it's not saving it as gif?

Client.DownloadFileAsync(myUri, Path.Combine(combinedTemp));

combinedTemp contain:

C:\Users\bout0_000\AppData\Local\mws\My Weather Station\temp\untitled.gif

And myUri contain: http://www.ims.gov.il/Ims/Pages/RadarImage.aspx?Row=9&TotalImages=10&LangID=1&Location=

But in the hard disk i'm getting empty file i see untitled.gif but it's empty.

This is the website i'm trying to get the image from:

gif file download

If you make on the image in the center right click and save picture as the file name is: radaraimage9 type gif. I'm saving it as untitled.gif

But why if i'm saving it manualy it's ok but with the program it's empty ?

Upvotes: 0

Views: 250

Answers (1)

babbageclunk
babbageclunk

Reputation: 8751

You're calling DownloadFileAsync, but you don't say that you're waiting for the asynchronous call to finish. If your program exits soon after the call, the file download won't have finished.

Try using DownloadFile instead. If that works then you need to change your program so it waits until its asynchronous tasks finish. If you still want the download to happen in the background (maybe your program is doing some other things at the same time, or downloading multiple files) you can wait for the DownloadFileCompleted event.

Upvotes: 2

Related Questions