Topic "Login with 2 key factor RSA Token"

Author Message


I am using the Winscpnet.dll for the first time.
Here's my code..
I keep getting an error access denied when I run the code below.

When I login through & Winscp.exe, providing the same hostname username password & Passcode I am able to login successfully

strWinSCPDllPath= (WINSCPNET.DLL path)

Set SCPSessionProtocol = DotNetFactory.CreateInstance("WinSCP.Protocol", strWinSCPDllPath)

Set SCPSessionOptions = DotNetFactory.CreateInstance("WinSCP.SessionOptions", strWinSCPDllPath )

Set SCPSession = DotNetFactory.CreateInstance("WinSCP.Session", strWinSCPDllPath)

'Setup session options

With SessionOptions
.Protocol = SessionProtocol.sFTP
.HostName = &Hostname
.UserName = &Username
.Password = (PASSCODE-RSA Token)
.GiveUpSecurityAndAcceptAnySshHostKey = true
.SshPrivateKeypassphrase = (PASSWORD)
End With
msgbox "Protocol not accepted"
End If

'Connect to the server
SCPSession.SessionLogPath= "Path"
SCPSession.Open SCPSessionOptions

If SCPSession.opened Then
msgbox " Connection Successful"
msgbox "Connection failed: " & Err.Description
End If

Any help appreciated
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24759
Location: Prague, Czechia
Enable password logging:

SCPSession.AddRawConfiguration("Logging\LogSensitive", "1")


And inspect the session log file, if a correct password is used.

If that does not help, please attach the log. You remove any data you consider sensitive. If you do not want to post the log publicly, you can mark the attachment as private.

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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License