I have to create this query to get some answer before i change my code.Pardon me if this question is doesn’t make sense to you guys.
Scenario 1:
string path :ftp://1.1.1.1/mpg/test";
FtpWebRequest requestDir = (FtpWebRequest)FtpWebRequest.Create(new Uri(path));
requestDir.Credentials = new NetworkCredential("sh","se");
requestDir.Method = WebRequestMethods.Ftp.MakeDirectory;
Using the same code to create the directory structure to connect my local Filezilla ftp server to do the job—Works Fine.
Scenario 2:
Used the above code to connect the remote ftp server to do the same job throws exception : Error 550 no file found or no Access.
Question 1 : I have a full permission to read/write for the folder,if its not a permission issue,what else i have to keep it in mind to look for it ?
Question 2: If i modified my code like
step1: Make”mpg” direcotry first
step2: make”test” directory after that,works fine
is that mean http://FTP.Makedirectory won’t support to create a subdirectory in the main dir ?
If that’s the case how it created in my local ftp server ?
Any help appreciated.
Thanks in Advance.
I dont know why exactly, but some ftp servers response differently. I know because this scenario exactly happened to me while developing dropf. If you are using Filezilla ftp server, create with subdirectories working, but not on IIS ftp server.
So i suggest you to write one method for creating directory, method takes one parameter ant it will be full path, in your scenario (mpg/test), and split it by ‘/’ and create one by one every directory. This way it works on Filezilla and IIS Ftp and some other ftp services.