public FileResult DownloadTarefa(Int32 id) { TAREFA_ANEXO item = baseApp.GetAnexoById(id); String arquivo = item.TAAN_AQ_ARQUIVO; Int32 pos = arquivo.LastIndexOf("/") + 1; String nomeDownload = arquivo.Substring(pos); String contentType = string.Empty; if (arquivo.Contains(".pdf")) { contentType = "application/pdf"; } else if (arquivo.Contains(".jpg")) { contentType = "image/jpg"; } else if (arquivo.Contains(".png")) { contentType = "image/png"; } return(File(arquivo, contentType, nomeDownload)); }