Azure存储API ContentDisposition

 大姑娘苍之瑜 发布于 2023-02-08 18:02

我看到Azure已经发布了blob的ContentDisposition属性:http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.windowsazure.storage.blob.blobproperties.contentdisposition( v= azure.10). aspx在他们的api版本3.0中.我已经在我现有的blob上设置了属性,但是当它们被下载时,内容处置标头不包含在响应中.

我已经验证,当我从Azure为该Blob的FetchAttributes属性实际上填充了ContentDisposition属性.

它在使用SAS时有效,但在没有SAS的情况下下载文件时则无效.

如果有人有洞察力,请告诉我.

1 个回答
  • 您可以查看DefaultServiceVersion您的存储帐户吗?为了Content-Disposition工作,我相信DefaultServiceVersion应该是2013-08-15.

    为了得到 DefaultServiceVersion:

        var cloudStorageAccount = new CloudStorageAccount(new StorageCredentials("accountname", "accountkey"), false);
        var serviceProperties = cloudStorageAccount.CreateCloudBlobClient().GetServiceProperties();
        var serviceVersion = serviceProperties.DefaultServiceVersion;
    

    设置 DefaultServiceVersion:

        var cloudStorageAccount = new CloudStorageAccount(new StorageCredentials("accountname", "accountkey"), false);
        var serviceProperties = cloudStorageAccount.CreateCloudBlobClient().GetServiceProperties();
        serviceProperties.DefaultServiceVersion = "2013-08-15";
        cloudStorageAccount.CreateCloudBlobClient().SetServiceProperties(serviceProperties);
    

    一旦你设置DefaultServiceVersion,它应该工作.

    2023-02-08 18:04 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有