I have uploaded some files to cloud file share via my MVC app. All good up till now.
Now i want to show link, set image source from the file share, but can't access the files from web browser. For eg, if i show an image with image source set to
https://mystorageaccount.file.core.windows.net/content/images/14_large_image.png
I get nothing and when i try to browse this file in web browser, i get following error:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error><Code>InvalidHeaderValue</Code><Message>The value for one of the HTTP headers is not in the correct format.
RequestId:8294dc3b-001a-00f5-1b96-9039c3000000
Time:2016-04-07T06:26:33.3731376Z</Message><HeaderName>x-ms-version</HeaderName><HeaderValue/></Error>
I think this could be credentials issue as but I am not sure. Any pointers please!
The only way to access Azure file storage is via SMB or Rest. There is not HTTP interface available.
From Get started with Azure File storage on Windows
File storage offers shared storage for applications using the standard SMB 2.1 or SMB 3.0 protocol. Microsoft Azure virtual machines and cloud services can share file data across application components via mounted shares, and on-premises applications can access file data in a share via the File storage API.
If you need anonymous HTTP access then you would need to use blob storage instead which has a {storagename}.blob.core.windows.net address
In order to access the files from HTTP (Rest) you need to first create the authorization headers, which are documented under the Get File documentation. The required authentication header is documented at Authentication for the Azure Storage Services The format of which is
Authorization="[SharedKey|SharedKeyLite] {AccountName}:{Signature}"
I'd expect it be possible to use an SAS token for the signature, but I've just tried this and I couldn't get it to work.