Download. xlsx file Error Resolution errors prompt: Excel finds unreadable content in "12.xlsx". Do you want to restore the contents of the workbook? If you trust the source of this workbook, click Yes. After you click Yes: Excel has completed file-level validation and repair. Some parts of this workbook may have been repaired or discarded. FileStream filestream=new FileStream (pfilename,filemode.open) long fileSize = Filestream.length; Context.response.contenttype= "Application/octet-stream"; Context.Response.AddHeader ("Content-disposition", "attachment; filename=" "+ filename +" ";"); Context.Response.AddHeader ("Content-length", filesize.tostring ()); Byte[] Filebuffer=new byte[filesize]; FileStream.Read (Filebuffer, 0, (int) fileSize); Context.Response.BinaryWrite (Filebuffer); Context.Response.End (); After adding the following line of code, the problem is solved Context.Response.AddHeader ("Content-length", filesize.tostring ());
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.