0

I upload all kind of applications (like pdf,excel, images and txt etc) to sql database. But when I download .xlsx file I am getting below error

Excel found unreadable content in 'filename.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.

While downloading I am using below code to download for all files.

 Dim decompressed As New AcedInflator
 Dim bytearr As Byte() = decompressed.Decompress(DirectCast(sqldr.Item(1), Byte()), 0, 0, 0)

 Response.AddHeader("Content-disposition", "attachment; filename=" & Filename)
 Response.ContentType = "application/octet-stream"
  'Write Array to Browser
 Response.BinaryWrite(bytearr)
  written = True

What should I do?

James123
  • 9,918
  • 51
  • 172
  • 316
  • i got this issue because it will download in excel as html table..if you press yes it will open but it annoys the user so i used OfficeOpenXml for excel download. – Sachu Jul 05 '15 at 05:42
  • 1
    Use correct `Response.ContentType` Refer to [Correct Content Type][1] [1]: http://stackoverflow.com/questions/2937465/what-is-correct-content-type-for-excel-files –  Jul 05 '15 at 06:20
  • @KailashPolai I did that too. Still didn't work – James123 Jul 05 '15 at 17:24

0 Answers0