[
  {
    "Id": "462429",
    "ThreadId": "218089",
    "Html": "<p>Hello All,</p>\r\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I am trying to download a zipped file sitting on FTP server. This file is a zipped file containing a xml file.</p>\r\n<p>The issue is that I am able to get the zipped file and xml file in it but that xml file is empty.</p>\r\n<p>Can somebody guide me through the correct process.\r\n<div style=\"color:black;background-color:white\">\r\n<pre>    FtpWebRequest request = (FtpWebRequest)WebRequest.Create(<span style=\"color:#a31515\">&quot;ftp://66.97.146.93/Offense_6_24_2010.zip&quot;</span>);\r\n            request.Method = WebRequestMethods.Ftp.DownloadFile;\r\n\r\n            <span style=\"color:green\">// This example assumes the FTP site uses anonymous logon.</span>\r\n            request.Credentials = <span style=\"color:blue\">new</span> NetworkCredential(<span style=\"color:#a31515\">&quot;&quot;</span>, <span style=\"color:#a31515\">&quot;&quot;</span>);\r\n\r\n            FtpWebResponse response = (FtpWebResponse)request.GetResponse();\r\n\r\n            Stream responseStream = response.GetResponseStream();\r\n            StreamReader reader = <span style=\"color:blue\">new</span> StreamReader(responseStream);\r\n\r\n Ionic.Zip.ZipInputStream zis = <span style=\"color:blue\">new</span> Ionic.Zip.ZipInputStream(responseStream);\r\n            \r\n\r\n                    Ionic.Zip.ZipEntry ze = zis.GetNextEntry();\r\n\r\n                    <span style=\"color:green\">//while (ze != null)</span>\r\n                    <span style=\"color:green\">//{</span>\r\n                    <span style=\"color:green\">//    MessageBox.Show(ze.FileName);</span>\r\n                    <span style=\"color:green\">//    ze = zis.GetNextEntry();</span>\r\n                    <span style=\"color:green\">//}</span>\r\n                    <span style=\"color:blue\">using</span> (Ionic.Zip.ZipFile Zfile =  <span style=\"color:blue\">new</span> Ionic.Zip.ZipFile())\r\n                    {\r\n                        Ionic.Zip.ZipEntry entry = Zfile.AddEntry(<span style=\"color:#a31515\">&quot;test.xml&quot;</span>, zis);\r\n                        Zfile.Save(<span style=\"color:#a31515\">@&quot;C:\\New.zip&quot;</span>);\r\n                    }\r\n</pre>\r\n</div>\r\n</p>\r\n<p>Thank you very much,</p>\r\n<p>Sid</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-07-01T17:47:36.983-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "653664",
    "ThreadId": "218089",
    "Html": "<p>Ah, no - you should not mix the use of ZipInputStream and ZipFile.&nbsp; They are alternative metaphors for dealing with zip archives.&nbsp; Choose one or the other, you should almost never use both in the same application.</p>\r\n<p>If you are using ZipInputStream, then you need to use ZipInputStream.GetNextEntry() iteratively, in a&nbsp;loop,&nbsp;in order to enumerate the entries in the zip file and extract them.&nbsp; Follow the examples for ZipInputStream in the documentation - they all show how do this.</p>\r\n<p>To use ZipFile in this case, you will likely want to save the contents of the FTP response stream into a file, then open the filesystem file with ZipFile.Read().&nbsp; Follow the documentation.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2011-08-06T06:59:41.433-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]