0
votes

I have setup FTPS with user isolation in IIS 7. I am trying to upload files via FtpWebRequest in .NET to a specific user's directory. I assumed that if I used the credentials for User1 to connect, it would automatically place the file in User1's folder. The problem is that the files get put into my web root, rather than the folder for the contextual user.

I do have a FTP site for the web root as well, so I understand why it is doing that. The web site FTP is running on port 21, but this user isolated FTP site is on port 990 (implicit TLS). How can I upload files directly to a user's folder? Using a path doesn't work ([ipaddress]/user1), nor can I add the port to the URI. ([ipaddress]:990)

1

1 Answers

0
votes

I was able to resolve this using AlexFTPS:

Essentially, this class library allows you specify that the FTP connection should use implicit TLS, thereby using port 990 by default. This could otherwise not be specified in .NET (as part of the hostname for example). This allowed me to upload a file to a specific users directory based on the credentials passed in. This also works if you have a standard FTP site on port 21.

For the basic code...

AlexFTPSInstance.Connect(["FtpHost"], new NetworkCredential(["FtpUsername"],["FtpPassword"]), ESSLSupportMode.CredentialsRequired | ESSLSupportMode.DataChannelRequested | ESSLSupportMode.Implicit);

client.PutFile(["LocalFileDirectory/LocalFileName"], ["ServerFileDirectory/ServerFileName"]);

AlexFTPS can be obtained here - https://ftps.codeplex.com/