Discuss this help topic in SecureBlackbox Forum
FTPS: Configure and use a custom filesystem adapter
By default TElSimpleFTPSServer creates an instance of TElDiskFileSystemAdapter for each connection and initializes its BasePath property with the value of RootDirectory property.
If you want to create a custom filesystem adapter or just have your own instance of the adapter being used (eg. SolFS adapter), the right place to do is in OnAuthAttempt event handler.
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
{
}
}