How to upload a file (using FTP) to a password protected folder in C #?

I have a password protected 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 folder that is not password protected, I get no errors. As far as I can tell, there is nothing wrong with the file name.

So what's the problem? How can I provide credentials in a password-protected folder (not to mention FTP credentials, because it is obvious that they authenticate correctly if error code 553 is returned)?

+6
c # ftp cpanel ftpwebrequest
source share
1 answer

I understood what the problem was (it was completely unrelated to password protection). The root directory for the FTP account I used was actually a subdirectory inside another directory. The directory I was trying to access was:

 www.example.com/example1/abc/ 

But the highest directory on which the FTP account was installed was:

 www.example.com/example1/ 

So, I pointed out / example 1 / abc as the directory to download the file, where it should simply have been / abc /, since it refers to the root directory of the FTP account, and not to the root of the entire domain. This way, I authenticated correctly, but since I was specifying the wrong relative directory, error code 553 was returned.

Newbie mistake.;)

+4
source share

All Articles