Topic "Unable File Permission Exception in VB.NET"

Author Message
RTavernier

Guest


Hi everyone !

I would like to know how to disable the FilePermission Exceptions everytime I'm transfering a file using vb.net


I can transfer the file fine but it throw the permission error when I check. And I would like the check to not throw this error especialy.

I'm using winscp Beta. (last one)

The code where i encounter the problem :

<Creation of the session...>
<Connexion OK...>

Dim transferOptions As New TransferOptions
transferOptions.TransferMode = TransferMode.Binary
transferOptions.FilePermissions = New FilePermissions(300)
Dim transferResult As TransferOperationResult

Dim nomfichier As String = System.IO.Path.GetFileName(a_FileName)

transferResult = sessions.PutFiles(<MyFile>, <PathOnServer>, False, transferOptions)

transferResult.Check()

sessions.Close()

Return True
Catch e As Exception
MsgBox("error sftp : " & e.Message & vbCrLf)
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
What's the exception exactly?
_________________
Martin Prikryl
RTavernier

Guest


Here is the display I get when it throw an exception (Message and toString of the exception).

Sorry It is in french. Do you want me to translate it ?

Cordialy,

Rémi
erreur transfert.PNG (24.22 KB) [Download]

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
So do not set the permissions (transferOptions.FilePermissions = New FilePermissions(300)), if you do not have permissions to set them.

You may also need to disable preserving of a timestamp.

This error is well documented:
https://winscp.net/eng/docs/message_preserve_time_perm
RTavernier

Guest


Ok I will try that. I come back to you if it works.
RTavernier

Guest


Thanks a lot Martin for your help,

The solution you gave me is working. I simply forgot to disable preserving the timestamp.

For the permissions I firstly try by not setting them but the system was still giving me the exception.

By doing both, it's now working perfectly fine.

Thanks a lot again

RT
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License