UnauthorizedAccessException when trying to create logfile using LogWriter property

0 votes
asked Sep 9, 2011 by ARV (160 points)
edited Sep 9, 2011

Hi,

I am using the rebex.net.sftp to connect. I am trying to use a log file to debug some issues.

Here is my code for the logwriter property.

Dim sftpClient As New Rebex.Net.Sftp() sftpClient.LogWriter = New Rebex.FileLogWriter("e:temp", Rebex.LogLevel.Debug) sftpClient.Connect(Domain, PortNumber) sftpClient.Login(Username, Password) sftpClient.GetFile(URL, LocalPath)

I am getting System.UnauthorizedAccessException to path "e:temp". I have verified that all the permissions are right. Infact my application writes different temp file to this directory using the same account. So, I am lost at this point. Any help is appreciated.

Thank you

Applies to: Rebex SFTP
commented Sep 9, 2011 by Lukas Pokorny (100,710 points)
edited Sep 9, 2011

Please try calling System.IO.File.WriteAllText("f:temp", "test"); - does it cause the same exception?

commented Sep 9, 2011 by Lukas Pokorny (100,710 points)
edited Sep 9, 2011

Also, what are you trying to achieve? Where would you like the log file to be placed? In a file inside the "temp" folder of the "e:" drive, or somewhere else?

1 Answer

0 votes
answered Sep 9, 2011 by ARV (160 points)
edited Sep 9, 2011

Yes, the .net class gave me the same exception. Apparently it is using the local system account for logging. After giving that account permissions to the folder, the logging is fine. Thank you very much for your response.

...