Possible to OpenWrite Without CWD Command?

Jan 22, 2016 at 12:59 AM
Edited Jan 22, 2016 at 3:04 AM
I need to upload files to a FTP server which has CWD (change working directory) command disabled.

I'm getting an exception at the moment because System.Net.FtpClient always send a CWD command before writing data.

The work around I have found so far is to set EnableThreadSafeDataConnections to false which is not preferable IMO.

Is there a better way of doing this? I'm not sure why CWD is needed for ThreadSafeDataConnection.
Mar 9, 2016 at 1:39 AM
Thread safe connections open a new connection to the server to execute the download. FTP is not a thread safe protocol; you can only do one thing at a time including holding a stream open on the server. The CWD command is executed to place the new connection in the same working directory as the parent so the paths match up if a stream is opened without using an absolute path.