uploading MemoryStream to Azure Storage Blob, Blob is empty. RRS feed

  • Question

  • I am trying to upload a Memory Stream where stream writer writes lines to the stream, then later on I will download the stream from the blob and save it as a Text file. The problem is that the storage blob is empty and the text file returns empty.

                     var ms = new MemoryStream();
                    using (StreamWriter w = new StreamWriter(ms, Encoding.UTF8))
                      ms.Position = 0;
                      w.write("Test Text");
                    var _blobname = DateTime.UtcNow.ToString("HHmmssMMddyyy");
                            var _container = Branch;
                                                 container = blobClient.GetContainerReference(_container.ToLower());
                                                   blockBlob = container.GetBlockBlobReference(_blobname);
                            ms.Position = 0;

    Rogelio Rios

    Thursday, March 17, 2016 6:39 AM

All replies