Explanation
This is an example of downloading a file to Amazon S3. If the file stored in S3 does not have 'Public-Read' permissions, the credentialing process may be required, so the 'Region/Bucket/AccessKey/SecretAccessKey' information is required. However, information such as 'AccessKey/SecretAccessKey' is not supposed to be exposed to the outside world, so it is dangerous to use it in public. To download without exposing your AWS credentials, you can generate a pre-signed address on the backend and use that address to download the file.
dx.setDownloadMode("AWSS3");
dx.setAWSS3DownloadConfig({
//type: "SECRET",
signedURL: dx5.canonicalize("../service/awss3-download-helper.ashx"),
});
The backend address is responsible for generating and returning the signed address needed to download the file. In order to return the signed address on the backend, we need to use the SDK provided by AWS, which can be installed via NuGet for ASP.NET. In our sample project, we put the required AWS SDK binary files in the packages folder. For details on generating signed addresses using the AWS SDK, see the awss3-download-helper.ashx generic handler.
Example
Singe-file download |
|
In the single-file download, when downloading with a signed address, the target is not from the same source, so the browser may not download the target and open it directly. |
|
Multiple-files download |
|
|