WinSCP .NET assembly open stored session

2.2k views Asked by At

How can I use the .NET assembly provided by WinSCP to open a stored session created from the WinSCP application?

1

There are 1 answers

0
Martin Prikryl On BEST ANSWER

You should not do this. Coupling the assembly with WinSCP application configuration can cause you lots of troubles. The assembly is deliberately isolated from WinSCP application by default.


There's nothing that you cannot configure using the SessionOptions class. Either using its properties, for basic options; or using the SessionOptions.AddRawSettings method, for advanced settings.

Easy way, is to have WinSCP generate the code for you.

enter image description here


In the past, you could abuse the Session.DefaultConfiguration and the SessionOptions.HostName to open a stored session. But the Session.DefaultConfiguration has been deprecated since WinSCP 5.8 and will be removed eventually.