Discuss this help topic in SecureBlackbox Forum
FTPS: Set the virtual root directory for individual connection
There are two ways of specifying the root for individual connection:
C#:
static void Main(string[] args)
{
TElSimpleFTPSServer Server = new TElSimpleFTPSServer();
Server.OnAuthAttempt += ElSimpleFtpsServerOnOnAuthAttempt;
...
}
private static void ElSimpleFtpsServerOnOnAuthAttempt(object sender, string username, string password, ref bool allow)
{
allow = false;
SBSimpleFTPSServer.TElSimpleFTPSServerSessionThread Sender = sender as TElSimpleFTPSServerSessionThread;
try
{
User user = UserRepository.Login(username, password);
allow = true;
// Create a new instance of the filesystem adapter
Sender.FileSystemAdapter = new MyCustomFileSystemAdapter(nil);
// set the virtual root dynamically
Sender.FileSystemAdapter.BasePath = UsersVirtualRootDir;
return;
}
catch
{
}
}