winscp-net

WinSCP .NET library: Connect to SFTP server without specifying SSH host key fingerprint

一个人想着一个人 提交于 2019-12-04 15:01:21
In the current stable release of WinSCP, it seems that using SshHostKeyFingerprint is mandatory and there are no ways to connect to SFTP server without that in SessionOptions . I can see that the ability to bypass is added to the beta (5.2) but I was wondering whether or not it's possible to connect without this fingerprint. First, make sure you understand that you give-up any security , when you try to bypass SSH host key check. You effectively lose a protection against man-in-the-middle attacks . Anyway, you can use use SessionOptions.GiveUpSecurityAndAcceptAnySshHostKey . It's NOT

File upload with WinSCP .NET/COM with temporary filenames

北慕城南 提交于 2019-12-04 07:26:57
I am creating a small .NET application in C# to upload files to an FTP Server. I am using the .NET DLL for WinSCP while doing this and i have been trying to find a good solution to my problem. The FTP folder where I will put all my files will be monitored by another application. This application will then take these files and process them automatically. So what I want to avoid is that my files are grabbed by the application before the transfer is complete. So I want to use either temporary filename usage or maybe a temporary folder and then move the files when upload is finished. What do you

Put long running method into task, showing new form meantime and closing it once the task completes

浪尽此生 提交于 2019-12-04 06:33:25
问题 My application has some long running method which taking some time to be finalised therefore i decided to push it into the separate task then meantime show some new form as ShowDialog which inside is placed hourglass animation and then this form should be closed when task finished the job. On that moment situation is that my new waiting form is not going to Close at all its just show up and stay. I read somewhere that its because ShowDialog in that case will not return nothing that's why

Powershell: Unable to find type when using PS 5 classes

孤人 提交于 2019-12-03 12:43:35
I'm using classes in PS with WinSCP Powershell Assembly. In one of the methods I'm using various types from WinSCP. This works fine as long as I already have the assembly added - however, because of the way Powershell reads the script when using classes (I assume?), an error is throwed before the assembly could be loaded. In fact, even if I put a Write-Host at the top, it will not load. Is there any way of forcing something to run before the rest of the file is parsed? Transfer() { $this.Logger = [Logger]::new() try { Add-Type -Path $this.Paths.WinSCP $ConnectionType = $this.FtpSettings

Put long running method into task, showing new form meantime and closing it once the task completes

删除回忆录丶 提交于 2019-12-02 12:44:35
My application has some long running method which taking some time to be finalised therefore i decided to push it into the separate task then meantime show some new form as ShowDialog which inside is placed hourglass animation and then this form should be closed when task finished the job. On that moment situation is that my new waiting form is not going to Close at all its just show up and stay. I read somewhere that its because ShowDialog in that case will not return nothing that's why Close will be never reached until user click Close manually on form, but how its possible as if I put form

Showing WinSCP .NET assembly transfer progress on WinForm's progress bar

非 Y 不嫁゛ 提交于 2019-12-01 13:51:23
Have some main form on which I am calling file downloading from FTP. When this operation is raised i want to see new form as ShowDialog and progress bar on it to be shown meantime, then show the progress and close new form and back to main form. My code is working however, when it will process is started my main form freezes and after while new form is appearing and then closing. What I would like to correct is to show this new form to be showed straightaway after process is executed. Can you take a look and tell me whats wrong? This is out of my main form the download process called: Dim pro

Showing WinSCP .NET assembly transfer progress on WinForm's progress bar

戏子无情 提交于 2019-12-01 12:41:38
问题 Have some main form on which I am calling file downloading from FTP. When this operation is raised i want to see new form as ShowDialog and progress bar on it to be shown meantime, then show the progress and close new form and back to main form. My code is working however, when it will process is started my main form freezes and after while new form is appearing and then closing. What I would like to correct is to show this new form to be showed straightaway after process is executed. Can you

PowerShell runtime exception - “could not load file or assembly”

前提是你 提交于 2019-12-01 03:24:05
This seems to be a common problem in PowerShell and Visual Studio, yet cases and solutions seem to vary a lot. Though seeing several similar questions, I didn't find a working solution for my issue yet. The problem exists in the error message Could not load file or assembly 'file:///C:\users\jenstmar\Desktop\WinSCP.dll' o r one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) The file location is invalid, as the .dll is supposed to be located in the same folder as the WinSCP installation. This location was changed to check that no rights or lack thereof,

Access remote file contents as a stream using WinSCP .NET assembly

放肆的年华 提交于 2019-11-30 22:13:11
I am trying to open file to read from SFTP using WinSCP .NET assembly as par to my exercise to archive file from SFTP to Azure blob. To upload a blob to Azure, I am using using (var fileStream = inputStream) { blockBlob.UploadFromStream(fileStream); blobUri = blockBlob.Uri.ToString(); } How to get the stream from the file on SFTP server? I managed using SftpClient to get the stream using the following code and it works but unfortunately not able to achieve the same using WinSCP .NET assembly. sftpClient.OpenRead(file.FullName) Can anyone help me how to achieve the same using WinSCP .NET

WinSCP .NET assembly: Where to define proxy?

≡放荡痞女 提交于 2019-11-30 15:08:25
问题 I am able to define the proxy server by using the WinSCP GUI. If I do this I am able to connect to a remote host. But in code I don't find a way to declare the proxy server for WinSCP. In this case I receive Remote server returned an error (407) Proxy authentication required. My code: SessionOptions sessionOptions = new SessionOptions { Protocol = protocol, HostName = hostname, UserName = user, Password = pass, PortNumber = portnumber }; using (Session session = new Session()) { session