Topic "Not able to create instance of Session class in c#."

Author Message
dgpuranik
[View user's profile]

Joined: 2013-06-25
Posts: 3
Location: United States
Hi,

I am using WinSCP to download and upload files in C# program. My code look like this

Code:
public Session OpenSftpSession ()
    {
      SessionOptions sessionOptions = new SessionOptions ();
      sessionOptions.Protocol = WinSCP.Protocol.Sftp;
      sessionOptions.HostName = this.hostName_;
      sessionOptions.UserName = this.userName_;
      sessionOptions.Password = this.password_;
      sessionOptions.SshHostKeyFingerprint = this.sshHostKeyFingerprint_;

      Session session = null;
      try
      {
        session = new Session ();
        session.Open (sessionOptions);
      }
      catch (Exception ex)
      {
        return null;
      }

      return session;
    }


When program execute line
Code:
session = new Session ();

it terminates. I don't even get any exception it just exception.

Thanks,
Darshan.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Inspect all debugger windows to see if you find something interesting.
_________________
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