6

I have password-protected a folder on my web server using CPanel (HTTP?). I am trying to upload a file via FTP in C#, but I keep getting this error:

The remote server returned an error: (553) File name not allowed.

When I use the same code to upload to a non-password protected folder I don't get any errors. There is nothing wrong with the file name as far as I can tell.

So what would the problem be? How do I supply credentials to the password-protected folder (not talking about the FTP credentials, because obviously those are authenticating properly if a 553 error code is being returned)?

  • Is this a Windows server? How is the folder password protected? Windows does not natively support simply password protecting a folder. It supports user level security on folders. The FTP login will assume a certain user identity on the server - this identity must have write access to the folder. I suspect maybe this 'password protection' may simply a property of the CPanel application? – James Gaunt Dec 12 '10 at 16:16

1 Answers1

4

I realized what the problem was (it was totally unrelated to password-protection). The root directory for the FTP account I was using was actually a sub-directory inside another directory. The directory I was trying to access was:

www.example.com/example1/abc/

But the highest directory that the FTP account had permissions to was:

www.example.com/example1/

So I was specifying /example1/abc as the directory to upload the file to, where as should it should have simply been /abc/, since it is all relative to the FTP account's root directory and not the root of the entire domain. So I was authenticating correctly, but because I was specifying the wrong relative directory the 553 error code was being returned.

Newbie mistake. ;)

  • Excelent! This was just what was happening to me on a migration I had to do last week. It's nice to see it was not only what I've imagined that it would be, but also, that someone had this problem before and solved it. – apacay Feb 06 '12 at 16:40