我看到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的情况下下载文件时则无效.
如果有人有洞察力,请告诉我.
您可以查看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
,它应该工作.