Sorry, I think you can get stuck. The WebRequestMethods.Ftp , for this post , will not support sending FTP commands other than supported, and for your use case, you will need your client to send "TYPE I" (for "image" or binary mode) before sending the SIZE command.
In addition, as a hacker workaround, you can try downloading the file β any file β before sending the SIZE command. With request.UseBinary = true for this request, it should force your client to send the "TYPE I" command to the FTP server. (And it doesnβt matter if the download request fails, the TYPE command will still be sent.) Most FTP servers that receive the TYPE command will consider TYPE for subsequent commands. Then, when you try the GetFileSize request GetFileSize , the FTP server may be in binary rather than ASCII mode, and your SIZE command may succeed.
Castaglia Jan 18 '16 at 2:51 on 2016-01-18 02:51
source share