Esempio n. 1
0
        // note the HTML Element name in this case the file must match the HttpPostedFileBase
        // variable name or you'll always get a numm
        public async Task <ActionResult> Download(string theFilePath)
        {
            System.IO.Stream blobInfo = null;
            if (ModelState.IsValid)
            {
                if (!String.IsNullOrWhiteSpace(theFilePath))
                {
                    blobInfo = await AzureStorageHelper.DownloadBlobAsyncSecure(theFilePath);

                    Trace.TraceInformation("the uri to the file is {0}", theFilePath);
                }

                //ViewBag.blobUri = blobInfo.Uri.ToString();
            }


            // get MIME type based on extension https://msdn.microsoft.com/en-us/library/system.web.mimemapping.getmimemapping
            string fileType = MimeMapping.GetMimeMapping(theFilePath);

            return(this.File(blobInfo, fileType));

            //return View();
        }