FTP连接错误500

时间:2015-01-02 09:58:23

标签: c# ftp filesize

我有代码,我控制文件的大小,但我有(500)内部服务器错误,当我尝试连接到FTP。当我尝试在Web浏览器中连接到同一个ftp地址时,它会运行,但是从程序中没有。 这是我的代码:

foreach (string Soubor in SeznamSouboru)
   {
     velikostdisk = new System.IO.FileInfo(Soubor).Length;
     FtpWebRequest request;                                
     request = (FtpWebRequest)FtpWebRequest.Create(("ftp://nw....") + Path.GetFileName(Soubor));                                                                                                     
     request.Credentials = new NetworkCredential(FtpJmeno, FtpHeslo);
     request.UsePassive = true;
     request.UseBinary = true;
     request.KeepAlive = true;
     request.Method = WebRequestMethods.Ftp.GetFileSize;
     FtpWebResponse response = (FtpWebResponse)request.GetResponse();
     velikostftp = response.ContentLength;
     //....other code                                
   }

错误在这里:

FtpWebResponse response = (FtpWebResponse)request.GetResponse();

有你的想法吗?

0 个答案:

没有答案
相关问题