繁体   English   中英

在“在MVC中下载”中将Zip文件中的所有文件换行

[英]Wrap all files in Zip file in Downloading in MVC

我正在使用以下代码在MVC中执行下载:

控制器:

 public ActionResult Download(string SysID)
    {
        try
        {

            byte[] fileData = Get Data in Byte array;
            if (fileData != null)
            {
                string fileName = "Mytest.bin";
                return File(fileData, "application/octet-stream", fileName);
            }
            else
                return null;
        }

        catch (Exception ex)
        {
            throw ex;
        }
    }

使用上面的代码,一切工作正常。 我能够生成.bin文件并成功下载。

问题:

我如何使用SharpZipLib将其包装在zip文件中? 我被限制使用SharpZipLib。 这背后的原因是我需要将此文件发送到我们已经使用SharpZipLib解压缩文件的其他系统。

请让我知道是否需要更多信息,我会尽力提供更多信息。

提前致谢。

请参阅下面的Create a Zip as a browser download attachment in IIS部分中的链接“ Create a Zip as a browser download attachment in IIS以创建和下载zip文件到浏览器。 希望这可以帮助。

https://github.com/icsharpcode/SharpZipLib/wiki/Zip-Samples#create-a-zip-as-a-browser-download-attachment-in-iis

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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