c# - Amazon S3 - MS office files corrupted when downloading -
when upload docx, xlsx or pptx amazon s3 using aws .net sdk file getting uploaded fine , able view file directly s3 without issues. when download file in asp.net using c# getting warning message (see below) when opening file:
"excel found unreadable content in test.xlsx. want recover contents of workbook?" if click yes, able see contents in document.
similarly getting warning message .docx file well.
this c# code using:
response.clear(); response.contenttype = "application/octet-stream"; response.addheader("content-disposition", "attachment; filename=" + filename); response.outputstream.write(content, 0, content.length); response.flush(); httpcontext.current.applicationinstance.completerequest(); update: when download file in windows forms app working fine , problem web app only.
what doing wrong?
please help...
more information needed figure out. code snippet provided looks ok. problem looks elsewhere in code... example, loading inside "content"?
also, if tried uploading , downloading simple text file, see kind of data gets appended.
Comments
Post a Comment