Question

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.

I've verified that when I FetchAttributes the properties from Azure for that Blob that the ContentDisposition property is in fact populated.

It does work when using SAS, but not when downloading the file without SAS.

If someone has insight please let me know.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top