Azure存储API ContentDisposition [英] Azure Storage API ContentDisposition
问题描述
我看到有天青发布blob的ContentDisposition属性:<一个href=\"http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.windowsazure.storage.blob.blobproperties.contentdisposition(v=azure.10).aspx\" rel=\"nofollow\">http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.windowsazure.storage.blob.blobproperties.contentdisposition(v=azure.10).aspx在他们的API 3.0版本。我设置在我现有的斑点的财产,但他们下载时,不包含在响应中的内容处置头。
I see that Azure has release the ContentDisposition property of a blob: http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.windowsazure.storage.blob.blobproperties.contentdisposition(v=azure.10).aspx in their version 3.0 of the api. I've set the property on my existing blobs, but when they are downloaded the content-disposition header is not included in the response.
我已经验证,当我从FetchAttributes Azure中的属性为斑点的ContentDisposition财产实际上是在填充。
I've verified that when I FetchAttributes the properties from Azure for that Blob that the ContentDisposition property is in fact populated.
它使用SAS时,下载文件,而无需SAS工作的时候,但不是。
It does work when using SAS, but not when downloading the file without SAS.
如果有人有深入了解,请让我知道。
If someone has insight please let me know.
推荐答案
可以请查看 DefaultServiceVersion
为您的存储帐户?对于内容处置
工作,我相信 DefaultServiceVersion
应 2013- 08-15
Can you please check the DefaultServiceVersion
for your storage account? For Content-Disposition
to work, I believe the DefaultServiceVersion
should be 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
,它应该工作。
这篇关于Azure存储API ContentDisposition的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!