[
  {
    "Id": "183511",
    "ThreadId": "54449",
    "Html": "<div><div>Hi, </div><div>  when i m using simple this works fine but when i assign paasword  for the particaular file its created problem to read.</div><div>  at the time of read i am getting this error message which is given below:</div><div><br></div><div><span style=\"font-family:verdana;font-size:11px\"><h2 style=\"font-family:verdana;font-weight:normal;font-size:14pt;color:maroon\"><em>You cannot change the encryption method on encrypted entries read from archives.</em></h2><span style=\"font-family:arial, helvetica, geneva, sunsans-regular, sans-serif\"><strong style=\"font-family:verdana;font-weight:bold;color:black;margin-top:-5px\">Description: </strong>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br><br><strong style=\"font-family:verdana;font-weight:bold;color:black;margin-top:-5px\">Exception Details: </strong>System.InvalidOperationException: You cannot change the encryption method on encrypted entries read from archives.<br><br><strong style=\"font-family:verdana;font-weight:bold;color:black;margin-top:-5px\">Source Error:</strong> <br><br><table width=\"100%\" style=\"background-color:rgb(255, 255, 204)\">    <tbody>        <tr>            <td><code>            <pre style=\"font-family:'lucida console';font-size:0.9em\"><span style=\"color:red\">Line 82:             using (ZipFile zip = ZipFile.Read(abFileContent))</span>Line 83:             {Line 84:                 </pre>            <pre style=\"font-family:'lucida console';font-size:0.9em\"></pre>            </code></td>        </tr>    </tbody></table></span></span></div><div><br></div><div>using Ionic.Zip;<br></div><div><br></div><div> byte[] abFileContent = new Byte[fileUpload1.PostedFile.ContentLength];</div><div> fileUpload1.PostedFile.InputStream.Read(abFileContent, 0, fileUpload1.PostedFile.ContentLength);</div><div><br></div><div> using (ZipFile zip = ZipFile.Read(abFileContent))</div><div>            {</div><div>                bool IsfileExists = false;<br></div><div>                foreach (ZipEntry zipe in zip.Entries)</div><div>                {</div><div>                    if (zipe.FileName.Equals(string.Format(&quot;{0}.xml&quot;, XMLFileName)))</div><div>                    {</div><div>                        IsfileExists = true;</div><div>                        if (!string.IsNullOrEmpty(password))</div><div>                            zipe.ExtractWithPassword(m_FilePath, password);</div><div>                        else</div><div>                            zipe.Extract(m_FilePath, true);</div><div>                       <br></div><div>                        break;</div><div>                    }</div><div>                }</div><div>                if (!IsfileExists)</div><div>                {</div><div>                    throw new FileNotFoundException(string.Format(&quot;{0}.xml file not found in source zip file&quot;, XMLFileName));</div><div>                }</div><div>            }</div><div><br></div><div><br></div><div>The code of ziping file with password</div><div><br></div><div>using Ionic.Zip;<br></div><div><br></div><div><div>System.Web.HttpContext.Current.Response.Clear();</div><div><br></div><div>            System.Web.HttpContext c = System.Web.HttpContext.Current;</div><div>            String ReadmeText = String.Format(obj.ReadmeContents, Environment.NewLine,</div><div>                                             System.DateTime.Now.ToString(&quot;G&quot;)                                             </div><div>                                             );</div><div>            string zipfileName = &quot;abc.zip&quot;;</div><div>            System.Web.HttpContext.Current.Response.ContentType = &quot;application/zip&quot;;</div><div>            System.Web.HttpContext.Current.Response.AddHeader(&quot;content-disposition&quot;, &quot;filename=&quot; + zipfileName);</div><div>         using (Stream str = new MemoryStream())<br></div><div>            {</div><div>                using (ZipFile zip = new ZipFile())</div><div>                {</div><div>                   ZipEntry e = zip.AddFileStream(string.Format(&quot;{0}.xml&quot;, XmlFileName), &quot;&quot;, str);</div><div>                   if (!string.IsNullOrEmpty(obj.ZipPassword))</div><div>                   {</div><div>                       e.Encryption = EncryptionAlgorithm.WinZipAes128;</div><div>                       e.Password = ZipPassword;</div><div>                   }</div><div>                    zip.AddFileFromString(string.Format(&quot;{0}.txt&quot;, ReadmeFileName), &quot;&quot;, ReadmeText);<br></div><div>                    zip.Comment = string.Format(&quot;{0}&quot;, ZipFileComment);</div><div>                    zip.Save(System.Web.HttpContext.Current.Response.OutputStream);</div><div>                }</div><div>            }</div><div><span style=\"white-space:pre\">\t</span>}</div></div><div><br></div></div>",
    "PostedDate": "2009-04-24T23:11:41.497-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "184618",
    "ThreadId": "54449",
    "Html": "Hmm, that's not good. <br>\r\nDid you post a work item on this?<br>\r\n<br>\r\nIs this the same as <br>\r\n<a href=\"http://dotnetzip.codeplex.com/WorkItem/View.aspx?WorkItemId=7696\">http://dotnetzip.codeplex.com/WorkItem/View.aspx?WorkItemId=7696</a><br>\r\n??\r\n",
    "PostedDate": "2009-04-28T10:35:04.423-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]