Hi I am using winscp 5.13.7 in c# code.
I have tried multiple options but it keeps giving me the error. I need to connect to us-west-2 region with initial bucket. It keeps giving me the bucket issue.
1.
SessionOptions sessionOptions = new SessionOptions
{
Protocol = WinSCP.Protocol.S3,
HostName = bucketName + ".s3-us-west-2.amazonaws.com" ,
PortNumber = 443,
UserName = ConfigurationManager.AppSettings["AWSAccessKey"],
Password = ConfigurationManager.AppSettings["AWSSecretKey"]
};
using (Session session = new Session())
{
sessionOptions.AddRawSettings("S3DefaultRegion", "us-west-2");
// Connect
session.Open(sessionOptions);
2. using ParseUrl method but with s3
.region
sessionOptions.ParseUrl("s3://user:pwd@s3.us-west-2.amazonaws.com/bucket/");
sessionOptions.AddRawSettings("S3DefaultRegion", "us-west-2");
// Connect
session.Open(sessionOptions);
3. using ParseUrl method but with s3
-region
sessionOptions.ParseUrl("s3://user:pwd@s3-us-west-2.amazonaws.com/bucket/");
sessionOptions.AddRawSettings("S3DefaultRegion", "us-west-2");
// Connect
session.Open(sessionOptions);
4. 3. using ParseUrl method
sessionOptions.ParseUrl("s3://user:pwd@bucket.s3-us-west-2.amazonaws.com");
sessionOptions.AddRawSettings("S3DefaultRegion", "us-west-2");
// Connect
session.Open(sessionOptions);
It always throws an error about us-east-1 being used instead of us-west-2.