wlalth 0 Newbie Poster

Hi, i wrote a patch system. It check the links and download them, if the files not same with the users files.

All steps are working, i have only one problem. First download is perfectly complated, but when DownloadFileAsycn fired second times, its don't work. It creates strange file of 0 bytes, with name of second file.

Im posting a part of my codes.

progressBar1.Value = 0;
            string netdboyu = "0";
            string userdboyu = "0";
            string webdizin = "my url is here";
            


            WebClient indir = new WebClient();
            indir.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
            indir.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
indir.DownloadFileAsync(new Uri(webdizin + filename), (filename));// filename is parameter of function.

These codes are under a function. When download process complated im calling it again, im using switch function before called. With that, my update function is trying to download the correct file. But can't download.

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.