我在此代码中遇到错误非静态字段,方法或属性'WinSCP.Session.Open(WinSCP.SessionOptions)'需要对象引用
谁能帮我一下。
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
connectToServer();
}
private void connectToServer()
{
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.Protocol = Protocol.Sftp;
sessionOptions.HostName = "server name";
sessionOptions.UserName = "user name";
sessionOptions.Password = "pass";
sessionOptions.PortNumber = 22;
sessionOptions.SshHostKeyFingerprint = "ssh-rsa key";
Session session = new Session();
session.SessionLogPath = "your log path";
Session.Open(sessionOptions);
}
凤凰求蛊
相关分类