Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16240

blob.Properties.ContentType when written to Blob Container is always application/octet stream

$
0
0

I am simply writing a json file to a Blob (please see my code below). I need it to be content = application/json but instead the blob json file reads "application/octet-stream" every time. I have set the blob.properties ContentType to = "application/json" but when I look in the Storage Explorer it says "application/octet-stream" every time.

static public void WriteBlob(string filename, string data)        {            string storageConnectionString = "DefaultEndpointsProtocol=https;AccountName=scadametrics;AccountKey=xxxxxxxxxxnfrsFRd/49Dmhn0HwKbxmpiA==;EndpointSuffix=core.windows.net";            var storageAccount = CloudStorageAccount.Parse(storageConnectionString);            var client = storageAccount.CreateCloudBlobClient();            var container = client.GetContainerReference("azfunc-out");//            string fileName = companyId.ToString() +"\\" + Guid.NewGuid();            var blob = container.GetBlockBlobReference(filename);            blob.Properties.ContentType = "application/json";            using (CloudBlobStream x = blob.OpenWriteAsync().Result)            {                byte[] bytes = Encoding.ASCII.GetBytes(data);                x.Write(bytes, 0, bytes.Length);                x.Flush();                x.Close();            }        }

Viewing all articles
Browse latest Browse all 16240

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>