Topic "How to Open a Stored Session"

Author Message
lee_qiao_2000@yahoo.com
[View user's profile]

Joined: 2012-05-22
Posts: 2
Location: NY
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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
It is not supported.
You can configure any session settings, including proxy, using SessionOptions.AddRawSettings though:
https://winscp.net/eng/docs/library_sessionoptions#methods
_________________
Martin Prikryl
lee_qiao_2000@yahoo.com
[View user's profile]

Joined: 2012-05-22
Posts: 2
Location: NY
prikryl wrote:
It is not supported.
You can configure any session settings, including proxy, using SessionOptions.AddRawSettings though:
https://winscp.net/eng/docs/library_sessionoptions#methods


That's good. Thank you!
Vara04
[View user's profile]

Joined: 2012-05-26
Posts: 5
Location: France
lee_qiao_2000@yahoo.com wrote:
prikryl wrote:
It is not supported.
You can configure any session settings, including proxy, using SessionOptions.AddRawSettings though:
https://winscp.net/eng/docs/library_sessionoptions#methods


That's good. Thank you!


I try this and it seems to work
Code:

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
Code:

[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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Yes this works. I suggest you use my suggested approach anyway.
_________________
Martin Prikryl
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