Post a reply

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)


Topic review


Re: S3 Session.Open failing on Session.HomePath

Your code is not accessing Session.HomePath at all. It cannot be throwing that exception. Double check what code did actually threw that error.

S3 Session.Open failing on Session.HomePath

I am trying to get generated code to work in a VB Script, but it fails within the WinSCP DLL at Session.HomePath with this error
"Session.HomePath' threw an exception of type 'System.InvalidOperationException' String {System.InvalidOperationException}"

Any ideas ?

Below is the script with my access and secret removed, it is trying to access a public S3 site, so anyone can put in their Access Key and Secret and you should be able to access the site.
' Set up session options
Dim sessionOptions As New SessionOptions
With sessionOptions
    .Protocol = Protocol.S3
    .HostName = ""
    .UserName = "xxxxxxxxx"     'Access Key
    .Password = "xxxxxxxxxxxx"       'Secret
End With
sessionOptions.AddRawSettings("S3DefaultRegion", "us-east-1")
sessionOptions.AddRawSettings("S3UrlStyle", "1")
Using session As New Session
    ' Connect
    session.Open(sessionOptions)   'fails here
    ' Transfer files
    session.GetFiles("/gov-fpac-rma-pubfs-production/pub/References/actuarial_data_master/2023/", "C:\temp\*").Check()
End Using