| Dart Home | PowerTCP FTP for .NET | Custom Development | Reply | PowerTCP FTP for .NET Topics | Forums |
| Author | Forum: PowerTCP FTP for .NET Topic: Exception from referenced asynchronous FTP object |
| skretsch From: omaha, NE USA Posts: 18 Member Since: 06/23/03 |
posted June 23, 2003 4:42 PM I'm getting an "Unhandled Exception in User's Event Handler" message for all error messages related to my asynchronous use of the FTP component using C#.Net via the IDE. I was having this problem with my main application, so I created a new C# application as seen below. I have all the code wrapped in try/catch blocks, so I'm not sure how the error is not being trapped. Any help would be appreciated! private void Form1_Load(object sender, System.EventArgs e) { try { //create a new ftp instance Dart.PowerTCP.Ftp.Ftp ftpFTP = new Dart.PowerTCP.Ftp.Ftp(); byte[] abytExport = System.Text.ASCIIEncoding.ASCII.GetBytes("test"); //set the properties for this instance ftpFTP.EndPut += new Dart.PowerTCP.Ftp.FileEventHandler(ftpFTP_EndPut); ftpFTP.Passive = false; ftpFTP.Client = "127.0.0.1"; ftpFTP.Server = "127.0.0.1"; ftpFTP.Username = "testftp"; ftpFTP.Password = "testftp"; ftpFTP.ServerPort = 21; ftpFTP.Timeout = 60000; //the memory stream to pass into the ftp control Stream stmExportStream = new MemoryStream(); //write the byte array to the stream so we can pass it stmExportStream.Write(abytExport, 0, abytExport.Length); //put the file in the location they want ftpFTP.BeginPut(stmExportStream, "/test.txt", null); } catch (Exception ex) { Console.WriteLine("Error here"); } } private static void ftpFTP_EndPut(object sender, Dart.PowerTCP.Ftp.FileEventArgs e) { try { Dart.PowerTCP.Ftp.Ftp ftpSender = (Dart.PowerTCP.Ftp.Ftp) sender; if (e.Exception == null) { Console.WriteLine("no error"); } else { Console.WriteLine("Error here"); } ftpSender.Close(); ftpSender.Dispose(); } catch (Exception ex) { Console.WriteLine("error"); } } |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted June 23, 2003 5:12 PM Hi, Please see my direct response. -ken |
| Reply | PowerTCP FTP for .NET Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|