Jan 21, 2013 at 8:03 AM
Edited Jan 21, 2013 at 9:14 AM
I've made a http handler that create a zip file dynamically and download the zip file from stream. In my handler, zipoutputstream is created as below.
using (ZipOutputStream output = new ZipOutputStream(context.Response.OutputStream))
And some files are created dynamically and added into the zipoutputstream with unique entry names when each file is created.
That seems to work fine, but sometimes an exception below occurs.
System.ArgumentException: an item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Ionic.Zip.ZipOutputStream._InitiateCurrentEntry(Boolean finishing)
at Ionic.Zip.ZipOutputStream.Dispose(Boolean disposing)
at MyProject.Web.MyHttpHandler.ProcessRequest(HttpContext context)
Sorry for my poor english. Please give me your help to solve this problem.