tags:

views:

43

answers:

1

Hi Im having trouble downloading files using asp.net mvc y ycode is quite straight forward and seems to work for pdf's only. It does not work for other filetypes

the code is below and the mime types I use for the documents are below.

return File(doc.filepath, mime, doc.title);
  1. Microsoft Word .doc application/msword
  2. Adobe Acrobat .pdf application/pdf
  3. Microsoft Powerpoint .ppt application/mspowerpoint
  4. Microsoft Excel .xls application/x-excel
  5. Text File .txt application/msword
A: 

try this:

    FilePathResult result = new FilePathResult(doc.filepath, mime);
    result.FileDownloadName = doc.title
    return result;
Bradley Landis