Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Download of .docx and .xlsx are corrupted
Message
De
15/12/2020 21:43:04
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Installation et Configuration
Titre:
Download of .docx and .xlsx are corrupted
Divers
Thread ID:
01677598
Message ID:
01677598
Vues:
44
I am setting up new servers for Windows Server 2019. This runs the same IIS configuration, bound to the same directory and the same executable. We only installed IIS as per the documentation I set up a few years ago. For some kind of reason, despite everything working fine on the new OS, when we download a .docx or a .xlsx file from the website, it ends up corrupted. I verified the MIME types on IIS and everything for those two file extensions are identical. I am wondering what else could be a factor.

The download is done via the .NET Transmit support. Basically, the content type is adjusted as per the extension. As I mentioned, this is the same executable. This is something in IIS or something that has to be installed which could affect IIS. I see ASP.Classic was installed in the Windows Server 2008. I do not believe we would need that support on Windows Server 2019 for a download of a Microsoft Office file to work.

Here is an example of how the transmit works for a Microsoft Word file (the real code is generic, I just changed this here so you can see the proper ContentType generated when this is a docx file:
oProcess.oResponse.Clear()
oProcess.oResponse.ClearContent()
oProcess.oResponse.ClearHeaders()
oProcess.oResponse.Charset = cCharset
oProcess.oResponse.ContentType = "application/ms-word"

oProcess.oResponse.AddHeader("Content-Disposition", "attachment;filename=" + lcFileNameDestination)

oProcess.oResponse.AddHeader("Content-Length", lnSize.ToString())
oProcess.oResponse.ContentEncoding = System.Text.Encoding.GetEncoding(cContentEncoding)

oProcess.oResponse.TransmitFile(cFile)

oProcess.oResponse.End()
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Répondre
Fil
Voir

Click here to load this message in the networking platform