InfoStatus
InfoStatus

Reputation: 7113

FTP Upload multiple files without disconnect using .NET

I'm uploading multiple files using FtpWebRequest.
But for every file I'm opening and closing a connection.

How can I upload multiple files using the same connection?

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

Upvotes: 7

Views: 7986

Answers (2)

DotNetWala
DotNetWala

Reputation: 6610

I had run into a similar issue. Transfer several related image files after corresponding DB updates are successful. I used the solution on this page 'http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx' to get a better performance. I too am opening and closing connection every time, except the images are loading in the background. I hope to find a better solution but this seems like a right direction.

Upvotes: 0

MArag
MArag

Reputation: 136

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

Upvotes: 1

Related Questions