<i id='EPEYC'><tr id='EPEYC'><dt id='EPEYC'><q id='EPEYC'><span id='EPEYC'><b id='EPEYC'><form id='EPEYC'><ins id='EPEYC'></ins><ul id='EPEYC'></ul><sub id='EPEYC'></sub></form><legend id='EPEYC'></legend><bdo id='EPEYC'><pre id='EPEYC'><center id='EPEYC'></center></pre></bdo></b><th id='EPEYC'></th></span></q></dt></tr></i><div id='EPEYC'><tfoot id='EPEYC'></tfoot><dl id='EPEYC'><fieldset id='EPEYC'></fieldset></dl></div>
  • <legend id='EPEYC'><style id='EPEYC'><dir id='EPEYC'><q id='EPEYC'></q></dir></style></legend>
    1. <tfoot id='EPEYC'></tfoot>

        <small id='EPEYC'></small><noframes id='EPEYC'>

          <bdo id='EPEYC'></bdo><ul id='EPEYC'></ul>

        获取“(553)文件名不允许"在 FTP 服务器上重命

        时间:2023-06-04
          1. <i id='ODinV'><tr id='ODinV'><dt id='ODinV'><q id='ODinV'><span id='ODinV'><b id='ODinV'><form id='ODinV'><ins id='ODinV'></ins><ul id='ODinV'></ul><sub id='ODinV'></sub></form><legend id='ODinV'></legend><bdo id='ODinV'><pre id='ODinV'><center id='ODinV'></center></pre></bdo></b><th id='ODinV'></th></span></q></dt></tr></i><div id='ODinV'><tfoot id='ODinV'></tfoot><dl id='ODinV'><fieldset id='ODinV'></fieldset></dl></div>
              <bdo id='ODinV'></bdo><ul id='ODinV'></ul>
            • <legend id='ODinV'><style id='ODinV'><dir id='ODinV'><q id='ODinV'></q></dir></style></legend>

            • <tfoot id='ODinV'></tfoot>

                    <tbody id='ODinV'></tbody>

                  <small id='ODinV'></small><noframes id='ODinV'>

                  本文介绍了获取“(553)文件名不允许"在 FTP 服务器上重命名文件时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  在我的应用程序中,我在 FTP 服务器的一个目录中有文件,我将该文件源移动到目标路径.在这个过程中,当我移动选定的源文件时,源文件不会显示在源路径中,它只会显示在目标路径中.

                  我尝试了以下代码,但出现错误:

                  string sourceurl = "ftp://ftp.com/Mainfoder/Folder1/subfolder/subsubfolder/"字符串 Targetpat ="ftp://ftp.com/Mainfoder/DownloadedFiles/"+subfolder+"/"+todaydatefolder+"/"+susubfolder;Uri serverFile = new Uri(sourceurl + 文件名);请求 = (FtpWebRequest)FtpWebRequest.Create(serverFile);request.Method = WebRequestMethods.Ftp.Rename;request.Credentials = new NetworkCredential(ftpUserID, ftpPassword);request.RenameTo = Targetpat+"/"+newfilename;//没有文件名的文件夹响应 = (FtpWebResponse)request.GetResponse();流 ftpStream = response.GetResponseStream();

                  <块引用>

                  System.dll 中出现System.Net.WebException"类型的未处理异常附加信息:远程服务器返回错误:(553) 文件名现在允许.

                  response = (FtpWebResponse)request.GetResponse();//这行抛出了上面的异常

                  request.RenameTo = newfilename:当我只设置 newfilename 时,它只重命名该源相同的文件名.

                  如何将此文件移动到同一 FTP 服务器中的另一个目录?

                  谁能告诉我.谢谢你

                  解决方案

                  作为 我之前已经给你写过:

                  <块引用>

                  request.RenameTo 仅采用路径.

                  所以这是错误的:

                  字符串 Targetpat ="ftp://ftp.com/Mainfoder/DownloadedFiles/"+subfolder+"/"+todaydatefolder+"/"+susubfolder;request.RenameTo = Targetpat+"/"+newfilename;

                  应该是:

                  字符串 Targetpat ="/Mainfoder/DownloadedFiles/"+subfolder+"/"+todaydatefolder+"/"+susubfolder;request.RenameTo = Targetpat+"/"+newfilename;

                  In my application, I have files in FTP server one directory and I move that file source to target path. In this process, when I move selected source file that source file will not show in the source path, it will show only in target path.

                  I tried this below code, but I am getting error:

                  string sourceurl = "ftp://ftp.com/Mainfoder/Folder1/subfolder/subsubfolder/"
                  string Targetpat =
                      "ftp://ftp.com/Mainfoder/DownloadedFiles/"+subfolder+"/"+todaydatefolder+"/"+susubfolder;
                  Uri serverFile = new Uri(sourceurl + filename);
                  request = (FtpWebRequest)FtpWebRequest.Create(serverFile);
                  request.Method = WebRequestMethods.Ftp.Rename;
                  request.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
                  request.RenameTo = Targetpat+"/"+newfilename;//folders without filename
                  response = (FtpWebResponse)request.GetResponse();               
                  Stream ftpStream = response.GetResponseStream();    
                  

                  An unhandled exception of type 'System.Net.WebException' occurred in System.dll Additional information: The remote server returned an error: (553) File name now allowed.

                  response = (FtpWebResponse)request.GetResponse(); //This line throwing the above exception   
                  

                  request.RenameTo = newfilename: when I set only newfilename, it renames that source same file name only.

                  How can I move this file to another directory within in same FTP server?

                  Please can anyone tell me. Thank you

                  解决方案

                  As I wrote you already before:

                  request.RenameTo takes a path only.

                  So this is wrong:

                  string Targetpat =
                      "ftp://ftp.com/Mainfoder/DownloadedFiles/"+subfolder+"/"+todaydatefolder+"/"+susubfolder;
                  request.RenameTo = Targetpat+"/"+newfilename;
                  

                  It should be:

                  string Targetpat =
                      "/Mainfoder/DownloadedFiles/"+subfolder+"/"+todaydatefolder+"/"+susubfolder;
                  request.RenameTo = Targetpat+"/"+newfilename;
                  

                  这篇关于获取“(553)文件名不允许"在 FTP 服务器上重命名文件时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:FtpWebRequest 返回“550 文件不可用(例如,文件未找 下一篇:将通过 HTTP 上传到 ASP.NET 的文件上传到 C# 中的

                  相关文章

                  最新文章

                    • <bdo id='dNsZY'></bdo><ul id='dNsZY'></ul>

                    <legend id='dNsZY'><style id='dNsZY'><dir id='dNsZY'><q id='dNsZY'></q></dir></style></legend>
                    <i id='dNsZY'><tr id='dNsZY'><dt id='dNsZY'><q id='dNsZY'><span id='dNsZY'><b id='dNsZY'><form id='dNsZY'><ins id='dNsZY'></ins><ul id='dNsZY'></ul><sub id='dNsZY'></sub></form><legend id='dNsZY'></legend><bdo id='dNsZY'><pre id='dNsZY'><center id='dNsZY'></center></pre></bdo></b><th id='dNsZY'></th></span></q></dt></tr></i><div id='dNsZY'><tfoot id='dNsZY'></tfoot><dl id='dNsZY'><fieldset id='dNsZY'></fieldset></dl></div>
                  1. <small id='dNsZY'></small><noframes id='dNsZY'>

                    <tfoot id='dNsZY'></tfoot>