Azure Storage API ContentDisposition

白昼怎懂夜的黑 提交于 2019-11-27 16:03:55

Can you please check the DefaultServiceVersion for your storage account? For Content-Disposition to work, I believe the DefaultServiceVersion should be 2013-08-15.

To get DefaultServiceVersion:

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

To set DefaultServiceVersion:

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

Once you set DefaultServiceVersion, it should work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!