admin管理员组文章数量:1289565
For some reason the zip file is always empty. zipInMemory.Length = 0 but below shows the zip with 2 entries... zipArchive
`Response.Clear()
Response.BufferOutput = False
Dim zipFileName As String = [String].Format("Zip_{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss"))
' Create the memoryStream
Using zipInMemory As MemoryStream = New MemoryStream()
' Create the zip file in memorystream
Using zipArchive As New ZipArchive(zipInMemory, ZipArchiveMode.Update)
' Add files to be compressed
For Each drawingdoc As String In drawingdoclist
If drawingdoc.Trim <> "" Then
Dim ZipEntry As ZipArchiveEntry = zipArchive.CreateEntry(drawingdoc)
End If
Next
Response.ContentType = "application/zip"
Response.AddHeader("content-disposition", "attachment; filename=" + zipFileName)
zipInMemory.WriteTo(Response.OutputStream)
Response.AddHeader("Content-Length", zipInMemory.Length)
Response.Flush()
End Using
End Using`
i've tried finding example with adding multiple files to a zip in a memorystream then outputting to a response. Expected the downloaded zip file to have 2 files in it.
本文标签: systemiocompressionVBNET ZipArchive from MemoryStream empty on responseStack Overflow
版权声明:本文标题:system.io.compression - VB.NET ZipArchive from MemoryStream empty on response - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741407202a2377019.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论