Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7864267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:44:02+00:00 2026-06-02T23:44:02+00:00

I completely fail to get dotnetzip to add files to a .zip file i

  • 0

I completely fail to get dotnetzip to add files to a .zip file

i can:

using (ZipFile zip = new ZipFile())
      {
zip.AddEntry("test.txt", DateTime.Now.ToString());
zip.Save(Response.OutputStream);
}

This is completed correctly and produces a zip file for download that can be opned with the text file inside

Problem: Trying to add files like this:

 zip.AddFile(Server.MapPath("/Files/test.txt"), "Files");

Always result in something like this:

[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +61
   System.IO.File.GetLastWriteTimeUtc(String path) +114
   System.IO.File.GetLastWriteTime(String path) +24
   Ionic.Zip.ZipEntry.Create(String nameInArchive, ZipEntrySource source, Object arg1, Object arg2) in c:\DotNetZip\Zip\ZipEntry.cs:2405
   Ionic.Zip.ZipEntry.CreateFromFile(String filename, String nameInArchive) in c:\DotNetZip\Zip\ZipEntry.cs:2313
   Ionic.Zip.ZipFile.AddFile(String fileName, String directoryPathInArchive) in c:\DotNetZip\Zip\ZipFile.AddUpdate.cs:406
   Ionic.Zip.ZipFile.AddFile(String fileName) in c:\DotNetZip\Zip\ZipFile.AddUpdate.cs:296
   MultiFileDownloader.WebForm1.Button1_Click(Object sender, EventArgs e) in D:\WORK\dynamicweb\StandardModules\MultiFileDownloader\Source\MultiFileDownloader\WebForm1.aspx.cs:54
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
   System.Web.UI.Page.ProcessRequest() +80
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.webform1_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\ade7bc1a\c2b11481\App_Web_txhzteca.0.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Note: My code can read/create the files with no problem. IIS user (and everyone infact) have total permissions to the files in question. IIS 7.5, win2008r2

How can I grant the DotNetZip assembly the same rights?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:44:04+00:00Added an answer on June 2, 2026 at 11:44 pm

    Figured it out my self:

    On application pool I set the Load User profile to true….problem solved. Guess the assembly was running without any user at all (not everyone, not anomnynous, not no one)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Completely new to most of this stuff, but basically Im playing around with the
Completely new to asp.net mvc... completely new to web apps so bear with me...
Completely new to java and I have been playing around with regex in a
The line below is completely failing. template: _.template($('#test').html()), Trying to follow a simple example
I am completely new to HTML5 and have been reading about it for the
I am completely new to Jena/TDB. All I want to do is to load
I'm completely new to javascript, but I'm trying to create a beta form for
I am Completely new to Objective C and Cocoa programming. Why does NSApplicationMain not
I'm trying to use Apache Commons Net for FTP file transfers. Problem is files
I can't seem to get a facebook connect app that I am building to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.