0

I have a very basic but working Azure Blob uploader/downloader built on C# ASP.net.

Except the download portion does not work. This block is called by the webpage and I simply get no response. The uploads are a mixture of images and raw files. I'm looking for the user to get prompted to select a destination and just have the file download to their machine. Can anyone see where I am going wrong?

[HttpPost]
        public void DownloadFile(string Name)
        {
        Uri uri = new Uri(Name);
        string filename = System.IO.Path.GetFileName(uri.LocalPath);
        CloudBlobContainer blobContainer = _blobStorageService.GetCloudBlobContainer();
        CloudBlockBlob blob = blobContainer.GetBlockBlobReference(filename);
        using (Stream outputFile = new FileStream("Downloaded.jpg", FileMode.Create))
        {
            blob.DownloadToStream(outputFile);
juvchan
  • 6,113
  • 2
  • 22
  • 35
Keith Thomson
  • 63
  • 4
  • 9
  • 2
    You are downloading on the server, not the "user" (client). I would suggest you write to memorystream and write to the Response something like answered [here](http://stackoverflow.com/questions/13779139/writing-memorystream-to-response-object) – Crowcoder Mar 25 '16 at 21:55
  • How do you debug this code block? Are you even able to hit any breakpoint in this function when you trigger a download file action on your webpage? – juvchan Mar 25 '16 at 23:04
  • @Crowcoder - Is there a reason you didn't post as an answer, vs a comment? – David Makogon Mar 25 '16 at 23:13
  • I typically only answer with code solutions, this was more of just a tip for you to find more info. – Crowcoder Mar 25 '16 at 23:18

0 Answers0