public IActionResult DownloadZip(string filename) { try { var stream = new FileStream(Path.Combine(AppSetting.Instance.TempUploadDirectory, filename), FileMode.Open); var mimeType = Factory.LoadMimeType("dummy.zip")?.FullType ?? "application/octet-stream"; var zipFilename = _urlController.UrlEncode("Media Files".Replace(" ", "_") + ".zip"); return(File(stream, mimeType, zipFilename)); } catch (FileNotFoundException) { return(NotFound("ZIP Archive Not Found: The ZIP file was not found on the server. This can happen when temporary files are removed during an application recycle. Try again.")); } catch (Exception ex) { AppEventController.LogError(ex); return(StatusCode(500, _exController.GetExString(ex))); } }