[
  {
    "Id": "695880",
    "ThreadId": "278860",
    "Html": "\r\n<p>I am using DotNetZip Library to zip files and render it on the browser. But getting permissions issue (stack trace shown below) when calling zip.Save(&quot;R.zip&quot;).</p>\r\n<p>&nbsp;</p>\r\n<p><strong>System.UnauthorizedAccessException was caught&nbsp; Message=Access to the path 'c:\\windows\\system32\\inetsrv\\DotNetZip-amowf3ht.tmp' is denied.&nbsp; Source=mscorlib&nbsp; StackTrace:&nbsp; &nbsp; &nbsp; &nbsp;at System.IO.__Error.WinIOError(Int32\r\n errorCode, String maybeFullPath)&nbsp; &nbsp; &nbsp; &nbsp;at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String\r\n msgPath, Boolean bFromProxy)&nbsp; &nbsp; &nbsp; &nbsp;at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)&nbsp; &nbsp; &nbsp; &nbsp;at System.IO.FileStream..ctor(String\r\n path, FileMode mode)&nbsp; &nbsp; &nbsp; &nbsp;at Ionic.Zip.SharedUtilities.CreateAndOpenUniqueTempFile(String dir, Stream&amp; fs, String&amp; filename)&nbsp; &nbsp; &nbsp; &nbsp;at Ionic.Zip.ZipFile.get_WriteStream()&nbsp; &nbsp; &nbsp; &nbsp;at Ionic.Zip.ZipFile.Save()&nbsp;\r\n &nbsp; &nbsp; &nbsp;at Ionic.Zip.ZipFile.Save(String fileName)&nbsp; &nbsp; &nbsp; &nbsp;at Opin.WebContent.Layouts.Opin.ReportsDownload.btnDownloadContent_Click(Object sender, EventArgs args)&nbsp; InnerException:&nbsp;</strong></p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>I changed the TempFileFolder to another folder which has permissions for NETWORKSERVICE account. Still not working and same permission issues.&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>Any thoughts?</p>\r\n",
    "PostedDate": "2011-11-09T07:05:46.32-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "696664",
    "ThreadId": "278860",
    "Html": "<p>Show your code.</p>\r\n<p>Show the code where you set the TempFileFolder and try saving the Zip file.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2011-11-10T13:27:30.433-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "696667",
    "ThreadId": "278860",
    "Html": "<p>also, what version of DotNetZip are you using?</p>",
    "PostedDate": "2011-11-10T13:29:56.807-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "696819",
    "ThreadId": "278860",
    "Html": "<p>I figured it out.&nbsp;</p>\r\n<p><strong>Issue:</strong></p>\r\n<p>zip.TempFileFolder = @\"D\\tempfolder\";</p>\r\n<p>zip.Save(\"my.zip\");&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p><strong>Fix:</strong></p>\r\n<p>zip.TempFileFolder = @\"D\\tempfolder\";</p>\r\n<p>zip.Save(@\"<span style=\"color: #ff0000;\">D\\tempfolder\\</span>my.zip\");</p>\r\n<p><strong><br /></strong></p>",
    "PostedDate": "2011-11-10T22:33:16.787-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "822829",
    "ThreadId": "278860",
    "Html": "<p>i have folder with name &nbsp;<strong>ZippedFiles </strong>in my site's root directory , iam saving all my zip files in that folder.</p>\n<p>i have another folder with name <strong>images </strong>which consists of all my image files.the following is the code to zip the image file.iam using&nbsp;<strong>DotNetZipLib-DevKit-v1.9 </strong>with .net 3.5</p>\n<p>use the namespace</p>\n<p><strong>using Ionic.Zip;</strong></p>\n<div style=\"color: black; background-color: white;\">\n<pre style=\"color: black;\"><span style=\"color: #0000ff;\"><div style=\"color: black; background-color: white;\"><pre><span style=\"color: blue;\">string</span> zipPath = Server.MapPath(<span style=\"color: #a31515;\">\"~/ZippedFiles/MyZipFile1.zip\"</span>);\n<span style=\"color: blue;\">using</span> (ZipFile zip = <span style=\"color: blue;\">new</span> ZipFile())\n{\nzip.AddFile(Server.MapPath(<span style=\"color: #a31515;\">\"~/images/img1.jpg\"</span>),<span style=\"color: blue;\">string</span>.Empty);\nzip.AddFile(Server.MapPath(<span style=\"color: #a31515;\">\"~/images/img2.jpg\"</span>),<span style=\"color: blue;\">string</span>.Empty);\nzip.AddFile(Server.MapPath(<span style=\"color: #a31515;\">\"~/images/img2.jpg\"</span>),<span style=\"color: blue;\">string</span>.Empty);\nzip.Save(zipPath);\n}\n</pre>\n</div>\n</span></pre>\n<pre style=\"color: black;\">the zipped file will created with all the images in it,if you have different file formats and you want your files to be saved in respective folders,you can specify the code as follows.</pre>\n</div>\n<pre><div style=\"color: black; background-color: white;\"><pre><span style=\"color: blue;\">string</span> zipPath = Server.MapPath(<span style=\"color: #a31515;\">\"~/ZippedFiles/MyZipFile1.zip\"</span>);\n<span style=\"color: blue;\">using</span> (ZipFile zip = <span style=\"color: blue;\">new</span> ZipFile())\n{\nzip.AddFile(Server.MapPath(<span style=\"color: #a31515;\">\"~/images/img1.jpg\"</span>), <span style=\"color: #a31515;\">\"images\"</span>);\nzip.AddFile(Server.MapPath(<span style=\"color: #a31515;\">\"~/images/img2.jpg\"</span>), <span style=\"color: #a31515;\">\"images\"</span>);\nzip.AddFile(Server.MapPath(<span style=\"color: #a31515;\">\"~/pdfs/customer.pdf\"</span>), <span style=\"color: #a31515;\">\"files\"</span>);\nzip.AddFile(Server.MapPath(<span style=\"color: #a31515;\">\"~/images/sample.doc\"</span>), <span style=\"color: #a31515;\">\"files\"</span>);\nzip.Save(zipPath);\n}\n</pre>\n</div>\n<pre>the newly created zipped file now contains two folders <strong>images </strong>---- &gt; <strong>img1.jpg</strong> , <strong>img2,.jpg </strong>and another folder <strong>files </strong>--&gt; <span style=\"background-color: white;\"><strong>customer.pdf</strong></span><span style=\"background-color: white;\">, </span><strong><span style=\"background-color: white;\">sample.doc</span></strong></pre>\n</pre>\n<pre><span style=\"background-color: white;\">\n</span><span style=\"background-color: white;\">I hope this will help someone. </span><span style=\"background-color: white;\">Thanks</span></pre>",
    "PostedDate": "2012-04-12T03:28:35.647-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]