R
Rakesh kumar Alajipur
Guest
I am trying to add MFA (Multi Factor Authentication) in my application, where i am going to store object in aws S3 buckets. Please provide any sample code for authenticate the amazon aws service through MFA while uploading the objects/image to s3 bucket using asp.net mvc c#.
Here is the below working code snippet without MFA,
var awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
_client = new AmazonS3Client(awsCredentials, Amazon.RegionEndpoint.USEast1);
var putRequest = new PutObjectRequest
{
BucketName = ConfigurationManager.AppSettings["S3BucketName"],
Key = fileName,
FilePath = localFilePath,
ContentType = "image/" + Path.GetExtension(fileName),
CannedACL = S3CannedACL.PublicRead
};
var req = JsonConvert.SerializeObject(putRequest);
Thanks,
Continue reading...
Here is the below working code snippet without MFA,
var awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
_client = new AmazonS3Client(awsCredentials, Amazon.RegionEndpoint.USEast1);
var putRequest = new PutObjectRequest
{
BucketName = ConfigurationManager.AppSettings["S3BucketName"],
Key = fileName,
FilePath = localFilePath,
ContentType = "image/" + Path.GetExtension(fileName),
CannedACL = S3CannedACL.PublicRead
};
var req = JsonConvert.SerializeObject(putRequest);
Thanks,
Continue reading...