ID CONTENT
1 Some data in varbinary type
Now i want to get the "Content" column data and should download as PDF format in Users Download folder with name "Report.PDF" file.
How should i this? I have tried like
Expand|Select|Wrap|Line Numbers
- public ActionResult DownloadFile(int fileId)
- {
- ResLandEntities reslandEntities = new ResLandEntities();
- var content = reslandEntities.ARTIFACT.Where(m => m.ID== fileId).FirstOrDefault();
- byte[] contents = content.CONTENT;
- string text = Encoding.UTF8.GetString(contents);
- return File(Server.MapPath("~/download/Report.PDF"), "application/pdf", text );
- }