0 votes
by (150 points)

We have implemented a custom File system provider derived from the ReadWriteFileSystemProvider class for our sftp erver. We would like to be able to log session information when a file/directory is created or deleted. I do not see any way to do this. For example, how could I do this in the following method we have overwritten?
protected override NodeBase Delete(NodeBase node)
{
...
}

Applies to: File Server, Rebex SFTP

1 Answer

0 votes
by (5.3k points)

Hi,
you are looking for ServerSession.Current property.

 var session = ServerSession.Current;

In the 'Delete' method.

 protected override NodeBase Delete(NodeBase node)
    {
       var myContext = ServerSession.Current.Context;
      _fileSystemNodes.Remove(node.Path);
      return node;
    }

Remark for other visitors of the Rebex forum.
Please be aware that ServerSession.Current can be null when the FileSystemProvider is running outside the FileServer.

by (150 points)
Perfect!  Just what I was looking for.
...