【发布时间】:2017-01-29 01:00:16
【问题描述】:
很清楚,我不想泄露 Azure 存储帐户密钥
如何在没有 Azure 存储帐户密钥的情况下从浏览器将本地文件加载到 BLOB 存储?
或者甚至可以做到吗?
我从一个厚实的 .NET 客户端获得,可以使用 SAS 来完成。
我们目前不支持基于 AD 的身份验证或 ACL,但支持 将其包含在我们的功能请求列表中。目前,Azure 存储 帐户密钥用于为文件共享提供身份验证。
这需要一条路径 FileUpload Class
protected void UploadButton_Click(object sender, EventArgs
{
// Specify the path on the server to
// save the uploaded file to.
String savePath = @"c:\temp\uploads\";
// Before attempting to perform operations
// on the file, verify that the FileUpload
// control contains a file.
if (FileUpload1.HasFile)
{
// Get the name of the file to upload.
String fileName = FileUpload1.FileName;
// Append the name of the file to upload to the path.
savePath += fileName;
// Call the SaveAs method to save the
// uploaded file to the specified path.
// This example does not perform all
// the necessary error checking.
// If a file with the same name
// already exists in the specified path,
// the uploaded file overwrites it.
FileUpload1.SaveAs(savePath);
我不明白如何使用 SAS 作为上传端点。
无论如何,我看不到将文件上传到 blob 的 ASP.NET 方式。
【问题讨论】:
-
您希望上传到 Blob 存储还是文件存储?如需直接上传到 Blob 存储,请参阅:stackoverflow.com/questions/19935404/…。
标签: asp.net azure file-upload azure-blob-storage