WebResponse = 553 File name is not allowed RRS feed

  • Question

  • Hello,

    I am trying to create a backup of the file using this code block:

                FtpWebResponse webResponse = null;
                string archiveFolder = "/Archive/Tuesday/";
                string fileUri = "ftp://Test/TestDropPoint/Prod/HELLO5.TXT";
                int lastSlash = fileUri.LastIndexOf("/");
                if (lastSlash != -1)
                string name = fileUri.Substring(lastSlash, fileUri.Length - lastSlash);
                FtpWebRequest webReq = (FtpWebRequest)FtpWebRequest.Create(fileUri);
                webReq.Credentials = new NetworkCredential(FtpUsername, FtpUserPassword);
                webReq.EnableSsl = FtpEnableSSL;
                webReq.UseBinary = FtpBinary;
                webReq.UsePassive = FtpUsePassive;
                webReq.KeepAlive = false;
                webReq.Method = WebRequestMethods.Ftp.Rename;
                webReq.RenameTo = archiveFolder + name;
                webReq.ConnectionGroupName = "MoveFile";
                webResponse = (FtpWebResponse)webReq.GetResponse();

    But I receive this error: WebResponse = 553 File name is not allowed.
    System.Net.WebException: The remote server returned an error: (553) File name not allowed.

    Here is my reference but still didnot work: https://social.msdn.microsoft.com/Forums/en-US/8c541130-b571-4b1a-9117-ac610f3e8b34/ftpwebrequestrenameto-property?forum=netfxnetcom 

    Kindly help.

    Tuesday, September 20, 2016 10:53 AM


  • Hi AllenTolentino,

    Thank you for posting here.

    I think this is server error not a code error. I think you should choose file name on server. I suspect there's already a

    directory with that name, and the conflict is preventing the upload.

    Here is similar solution, I hope the message can help you solve issue.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    • Proposed as answer by DotNet Wang Monday, October 10, 2016 6:02 AM
    • Marked as answer by DotNet Wang Monday, October 10, 2016 6:22 AM
    Friday, September 30, 2016 6:06 AM