0

我已经阅读了许多与相同错误相关的帖子,但在 C#.net windows application 中找不到修复,因为下面的代码使用的是 ftpFactory 类。

我得到 530 个非匿名会话必须在 C#.net 中使用加密

它在 SENDCOMMAND("USER" " + remoteUser) 附近失败,并在下面的代码中抛出“530 非匿名会话必须使用加密”。

我将其更改为通过 PROTOCOL: FTPS (SSL/TLS) 或等效协议进行保护

clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        IPEndPoint ep = new IPEndPoint(Dns.Resolve(remoteHost).AddressList[0], remotePort);


        try { clientSocket.Connect(ep); }

        catch (Exception) { throw new IOException("Couldn't connect to 
        remote server"); }

        readReply();
        if (retValue != 220)
        {
            close();
            throw new IOException(reply.Substring(4));
        }
        sendCommand("USER " + remoteUser);

        if (!(retValue == 331 || retValue == 230))
        {
            cleanup();
            throw new IOException(reply.Substring(4));
        }

        if (retValue != 230)
        {

            sendCommand("PASS " + remotePass);
            if (!(retValue == 230 || retValue == 202))
            {
                cleanup();
                throw new IOException(reply.Substring(4));
            }
        }

        logined = true;

        chdir(remotePath);

任何帮助表示赞赏。

4

0 回答 0