Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to pass parameters to webclient.uploadFileAsyncEventHandler()

how to pass parameters to webclient.uploadFileAsyncEventHandler()

Scheduled Pinned Locked Moved C#
csharpdatabasesysadmincloudtutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anumadhu
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups