Read file from FTP to memory in C#

前端 未结 9 1514
长发绾君心
长发绾君心 2020-12-03 05:15

I want to read a file from a FTP server without downloading it to a local file. I wrote a function but it does not work:

private string GetServerVersion()
{
         


        
9条回答
  •  广开言路
    2020-12-03 05:56

    It is impossible to know what the issue is without details about the error/exception.

    At a guess, you do not seem to be assigning a new value to version after the initial declaration

    string version = "";
    

    Try changing your code to

    version = System.Text.Encoding.UTF8.GetString(newFileData);
    

提交回复
热议问题