Handling FileContentResult when file is not found
I have a controller action that downloads a file from an azure blob based on the container reference name (i.e. full path name of the file in the blob). The code looks something like this: public FileContentResult GetDocument(String pathName) { try { Byte[] buffer = BlobStorage.DownloadFile(pathName); FileContentResult result = new FileContentResult(buffer, "PDF"); String[] folders = pathName.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries); // get the last one as actual "file name" based on some convention result.FileDownloadName = folders[folders.Length - 1]; return result;