FTP Upload multiple files without disconnecting using .NET.

I upload multiple files using FtpWebRequest.
But for each file, I open and close the connection.

How to upload multiple files using the same connection?

Like the ftp client application, connect using the username and password, change the directory, upload file1, upload file2, upload file3, disconnect.

+7
ftp
source share
2 answers

The default value of FtpWebRequest.KeepAlive is true. Are you explicitly setting KeepAlive to false?

+1
source share

I had a similar problem. Transfer several linked image files after successfully updating the corresponding database updates. I used the solution on this page http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx 'to get the best performance. I also open and close the connection every time, except that the images load in the background. I hope to find a better solution, but that seems like the right direction.

0
source share

All Articles