public async Task <FileResult> DownloadFile(int id) { var file = await _postAppService.GetAttachment(id); var realUrl = file.ContentUrl; if (!file.StoredInCdn) { realUrl = Server.MapPath(file.ContentUrl); } try { var fileBytes = System.IO.File.ReadAllBytes(realUrl); return(File(fileBytes, file.FileName)); } catch (Exception ex) { throw new UserFriendlyException(ex.Message); } }