FtpWebRequest reqFTP;
try
{
// 根据uri创建FtpWebRequest对象
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + sServerIP + "/")); reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
;
reqFTP.UseBinary = true; reqFTP.Credentials = new NetworkCredential(“账号", “密码");
//
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse(); //登陆成功
}
catch
{
//这边就是登陆不成功
}