public Command ( string cmd ) : void | ||
cmd | string | A |
return | void |
public void Connect(string userName, string password) { FtpControlChannel ctrl = new FtpControlChannel(m_host); ctrl.Server = m_server; ctrl.Port = m_port; ctrl.Connect(); try { ctrl.Command("USER " + userName); if (ctrl.LastResponse.Code == FtpResponse.UserAcceptedWaitingPass) { ctrl.Command("PASS " + password); } if (ctrl.LastResponse.Code != FtpResponse.UserLoggedIn) { throw new FtpAuthenticationException("Failed to login.", ctrl.LastResponse); } m_host.State = new FtpSessionConnected(m_host, ctrl, m_caseInsensitive); ((FtpSessionConnected)m_host.State).InitRootDirectory(); } catch { ctrl.Close(); throw; } }
public void Connect(string userName, string password) { FtpControlChannel ctrl = new FtpControlChannel(m_host); ctrl.Server = m_server; ctrl.Port = m_port; ctrl.Connect(); try { ctrl.Command("USER " + userName); if (ctrl.LastResponse.Code == FtpResponse.UserAcceptedWaitingPass) ctrl.Command("PASS " + password); if (ctrl.LastResponse.Code != FtpResponse.UserLoggedIn) throw new FtpAuthenticationException("Failed to login.", ctrl.LastResponse); m_host.State = new FtpSessionConnected(m_host, ctrl, m_caseInsensitive); ((FtpSessionConnected)m_host.State).InitRootDirectory(); } catch { ctrl.Close(); throw; } }