public void MakeDir(string dirName)
{
FtpWebRequest reqFTP;
try
{
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI + dirName));
reqFTP.Method = WebRequestMethods.Ftp.MakeDirectory;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream(); ftpStream.Close();
response.Close();
}
catch (Exception ex)
{
Error_Log("FTP创建文件夹时发成错误,详细错误参数请查看错误日志。", "MakeDir Error --> " + ex.Message + "\r\n" + ex.StackTrace);
}
}
以上代码是在ftp上创建文件夹的代码,我在创建第一次的时候好用,第二次在执行的时候就报错,远程服务器返回错误: (550) 文件不可用(例如,未找到文件,无法访问,求高手解答,我第二次创建的格式是
ftp://ip地址//文件夹名称//第二次的文件夹名称
第三次第四次依次类推
又报错了,还是一样的错误,换个ftp服务器就报错,什么情况啊
权限问题?
设置它的两个属性
reqFTP.KeepAlive = false;
reqFTP.Proxy = null;
希望能帮助到需要帮助的人