Hello all!
Ok, I'm writing an app that creates a specific folder tree on my FTP server. The app asks for a customer name and a project ID. When that is given and button is clicked, I want to create a folder name based off of the customer name, a subfolder under that with the Project ID number, and then 3 specific subfolders under the ProjectID folder. Here's my code:
FtpWebRequest req = (FtpWebRequest)WebRequest.Create(custPath); //---------------------
req.Credentials = new NetworkCredential("username", "passw"); // Create ftp folder for
req.Method = WebRequestMethods.Ftp.MakeDirectory; // customer name and project ID
FtpWebResponse makeDirectoryResponse = (FtpWebResponse)req.GetResponse(); //------------------------------
FtpWebRequest req1 = (FtpWebRequest)WebRequest.Create(custPath1); //--------------------
req1.Credentials = new NetworkCredential("username", "passw"); // Creates XML folder
req1.Method = WebRequestMethods.Ftp.MakeDirectory; //
FtpWebResponse makeDirectoryResponse1 = (FtpWebResponse)req1.GetResponse(); //--------------------
FtpWebRequest req2 = (FtpWebRequest)WebRequest.Create(custPath2); //-----------------------
req2.Credentials = new NetworkCredential("username", "passw"); // Creates the Logs folder
req2.Method = WebRequestMethods.Ftp.MakeDirectory; //
FtpWebResponse makeDirectoryResponse2 = (FtpWebResponse)req2.GetResponse(); //-----------------------
FtpWebRequest req3 = (FtpWebRequest)WebRequest.Create(custPath3); //-----------------------
req3.Credentials = new NetworkCredential("username", "passw"); // Creates the Help Folder
req3.Method = WebRequestMethods.Ftp.MakeDirectory; //
FtpWebResponse makeDirectoryResponse3 = (FtpWebResponse)req3.GetResponse(); //-----------------------
It worked once, and then never worked again. That's what really boggles me. Anyways, I now get a WebException was unhandled error: Remote server returned an error (550) File unavailable (not found, no access) on line 4 or the first FtpWebResponse makeDirectoryResponse statement.
As soon as the folders are created, I have a file uploaded to one of the folders. That actually works, but only if the folders are already there, so the above issue is holding me up.
Any thoughts?
Thanks,
Hendo