how to pass parameters to webclient.uploadFileAsyncEventHandler()
-
Hello everyone, I am developing a module in C#.net3.0 on windows XP. I am downloading a file from the ftp server in asynchronous mode. Before the download completes, i am doing another Async download of another file by again creating the object of WebClient with the same name. I am handling the downloadFileCompleteEventHandler(Object sender, AsyncEventHandler e). Now i want to see which file download has raised this event handler. For this, i think i have to send file name as parameter to this downloadFileCompleteEventHandler(Object sender, AsyncEventHandler e) method. My code snippet is as follows: private void FtpToStagingServer(String spotID, Int32 Ctr) { //DOWNLOADING TO LOCAL DATABASE SERVER WebClient ccftp = new WebClient(); try { //Download from Clearcut Server ccftp.Credentials = new NetworkCredential(Username, Password); Uri CcFtp = new Uri("ftp://"+HostIp+"/Assets/"+spotID+".mpg"); ccftp.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(ccftp_DownloadFileCompleted); ccftp.DownloadFileAsync(CcFtp, "C:\\AWS_FilesDownloaded\\"+spotID+".mpg"); tAssetId = spotID; } catch (WebException wes) { } catch (Exception es) { } // throw new Exception("The method or operation is not implemented."); } void ccftp_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { //Transfer the downloaded asset from Clearcut server to the Staging server/ MessageBox.Show(" Ftp from clearcut to local drive completed"); WebClient ssFtp = new WebClient(); try { ssFtp.Credentials = new NetworkCredential("abc", "abc123"); ssFtp.UploadFileCompleted += new UploadFileCompletedEventHandler(ssFtp_UploadFileCompleted); ssFtp.UploadFileAsync(new Uri("ftp://somehostIpwith path/"+ tAssetId+".mpg"), "C:\\AWS_cc_download\\" + tAssetId + ".mpg"); } catch (WebException wes) { } catch (Exception es) { } //throw new Exception("The method or operation is not implemented."); } I am trying it by taking a temporary