title: MVC FileContentResult - Works for DOC not PDF
body: <p>I have the following ActionResult:</p>
  
  <pre><code>[Authorize]
  public ActionResult DownloadFile(Guid id)
  {
      AdjusterFile file = (from f in db.AdjusterFiles
                           join a in db.Adjusters
                           on f.adjusterID equals a.id
                           join u in db.Users
                           on a.userID equals u.id
                           where u.username == HttpContext.User.Identity.Name
                           &amp;&amp; f.id == id
                           select f)
                          .FirstOrDefault();
  
      return new FileContentResult(file.fileContent.ToArray(), file.fileContentType);
  }
  </code></pre>
  
  <p>It works perfectly for word documents (DOC/DOCX).  However, whenever I try to download PDFs  which are uploaded by the same process, it says, "<strong>Failed to load PDF document</strong>" in Chrome.  In IE, it says, "<strong>The file is damaged and could not be repaired</strong>."</p>
  
  <p>The content type is "application/pdf."</p>
  
  <p>How can I download PDFs in MVC?</p>
  
  <p>Relevant file upload code:</p>
  
  <pre><code>using (MemoryStream ms = new MemoryStream())
  {
      file.InputStream.CopyTo(ms);
      byte[] array = ms.GetBuffer();
  
      AdjusterFile newFile = new AdjusterFile();
  
      newFile.id = Guid.NewGuid();
      newFile.adjusterID = adj.id;
      newFile.type = "eo";
      newFile.fileName = file.FileName;
      newFile.fileContent = array;
      newFile.fileContentType = file.ContentType;
  
      db.AdjusterFiles.InsertOnSubmit(newFile);
  }
  </code></pre>