我正在使用 c#.net 应用程序,我需要在其中使用 c# codebase 下载 zip 文件。我正在使用以下代码下载文件:
Response.ContentType = "application/zip"
Response.AppendHeader("Content-Disposition", string.Format("attachment; filename = {0}", System.IO.Path.GetFileName(sZipFileName)));
Response.TransmitFile(sZipFilePath);
HttpContext.Current.ApplicationInstance.CompleteRequest();
zip 文件已传输,但是当我在下载后尝试打开 zip 文件时,我收到一条错误消息“无法打开文件:文件看起来不是有效的存档”
请让我知道我在哪里做错了,以及如何获取一个 zip 文件并在没有任何错误的情况下提取它。
提前致谢