1
votes

I appreciate there's a way to set an Azure blob's content type at upload, so that you can then effectively specify whether a blob would likely be opened in a browser window or downloaded. For instance:

blob.Properties.ContentType = "video/mp4";

would ensure if the browser could play a mp4 it would do so rather than download the file. But I'd quite like to allow a user to do either. They would select whether to open or download a file.

I know I can do this by downloading the blob through our server and writing it back out to the browser, which I'm keen to avoid because of the overhead. I'm hoping there's some way to specify or override the content type in a blob request URI. So URI 1 would set the content type to "video/mp4" and URI 2 would set the content type to "application/octet-stream".

1

1 Answers

2
votes

No there is no way to achieve what you describe with only Azure Blob Stroage.

The content type can only be changed via a service request to the blob service and not "set" dynamically. Allowing to set content type dynamically via query string would be a major security risk and even I would not allow this if I would be building a service.

If you truly want to achieve this you have to write it on your own as you described via downloading to a WebRole and then re-streaming back to the user.