Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: How to Open a Stored Session

Yes this works. I suggest you use my suggested approach anyway.
Vara04

Re: How to Open a Stored Session

lee_qiao_2000@yahoo.com wrote:

martin wrote:

It is not supported.
You can configure any session settings, including proxy, using SessionOptions.AddRawSettings though:
https://winscp.net/eng/docs/library_sessionoptions_addrawsettings


That's good. Thank you!


I try this and it seems to work
SessionOptions sessionOptions = new SessionOptions

{
Protocol = Protocol.Ftp,
HostName = "TestFTPLocal",
};

using (Session session = new Session())
{
   session.DefaultConfiguration = false;
   session.IniFilePath =@"D:\yourdir\winscp.ini";
   // Connect
   session.Open(sessionOptions);
   ...
}


And in "D:\yourdir\winscp.ini", I set my conf
[Sessions\TestFTPLocal]

HostName=myserver
PortNumber=21
UserName=myuser
FSProtocol=5
Password=[encryptPwd]


I copy this from winscp.ini of winscp GUI

I hope it helps you
lee_qiao_2000@yahoo.com

How to Open a Stored Session

Hi!

I know we can open a session using SessionOptions class. How can we open a session with stored session? Sometimes we have to use proxy, which can be specified in the GUI and stored, and this can't be added in SessionOptions.

Thanks in advance.

L