Hi there
i use from following code for download a file from ftp server but it doesn't work......
what's that problem ?!......
i use from following code for download a file from ftp server but it doesn't work......
what's that problem ?!......
Code:
//FTP Class public event DownloadProgressChangedEventHandler DownloadProgressChanged; public event AsyncCompletedEventHandler DownloadFileCompleted; public void Download(string fileName,string savePath) { WebClient client = new WebClient(); client.Credentials = new NetworkCredential(loginUsername, loginPass); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.DownloadFileAsync(new Uri(ftpUrl + fileName), savePath); } void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) { if (this.DownloadProgressChanged != null) this.DownloadProgressChanged(sender, e); } void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { if (this.DownloadFileCompleted != null) this.DownloadFileCompleted(sender, e); } //Form Class FtpManager manager = new FtpManager(ftpUrl, username, password, FtpManager.FtpMethod.TransferFile); manager.DownloadProgressChanged += new DownloadProgressChangedEventHandler(manager_DownloadProgressChanged); manager.DownloadFileCompleted += new AsyncCompletedEventHandler(manager_DownloadFileCompleted); manager.Download(item.Text, "c:\\");
Comment