简体   繁体   中英

Error trying to send zip file to navigator

I'm trying to send a zip file to navigator in ASP.NET Visual Basic, I do the following:

Response.Clear()
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName)
Response.ContentType = "application/zip"
Response.WriteFile(fullPath)
Response.End()

I get this strange characters

在此处输入图像描述

How can I send the zip to navigator?

A zip file is NOT a text file. Don't treat it like a text file. Don't try viewing it like a text file.

Rather, a ZIP file is a binary file format. It is a container (also often called an archive) that contains compressed files. What you see there in your screenshot is just the binary data of the ZIP file. Binary data which whatever viewer you used tried to interpret as character codes -- which of course will not yield any sensible result, because a ZIP file is not a text file. It's not.

If you want to get your hands on the files compressed within the ZIP file, you need to uncompress ("unpack") the ZIP file.

By the way, i can see that the compressed file within the ZIP file is presumably a PDF file. Which is also not a text file, but requires a PDF reader/viewer to display/render it (after it has been unpacked from the ZIP file, obviously...).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM