Error when downloading file from amazon s3

Question:

I am trying to download files from amazon s3. I am using .NET sdk for that. I have written down follwong code:

With this code I am able to download file. But now I want to download multiple files. For that first I am listing down all the files which are available on s3 and then store it in arraylist and after that call my download function for each file.

After running list file method when I call download function after using (GetObjectResponse response = s3Client.GetObject(request)) I get exception.

{“Access Denied”}

Status code:

System.Net.HttpStatusCode.Forbidden

What do I need to do to fix this?

I have also tried different approach to download file and got the same error:

Second approach:

Thanks in advance.

Answer:


pass the value in function get stream path save it in folder with use of below.

and than you can apply simple c# code to download that folder.

Leave a Reply