0

There is a application that uploads zip file and extracts it in Temp folder located under application folder and then copies these extracted file to some different target location and deleted these temporary extracted files from Temp folder. Everything works fine on my local machine on IIS but when i place the same code on server machine it give File I/O permission error ,even though i have given full access permission to Temp and Target location Folder. Can anyone help me on this??

Here is the same code

 string path = Server.MapPath("~/UploadedZipFiles/" + filename);
 fileUpload1.SaveAs(path);//saves zip in temporary folder
 ExtractZIP(filename, targetfolder);  //extracts the zip folder contains to       //target folder path
  • The important bit to remember about any permissions-related issues is that permissions are specific to an identity (user). You need to determine which user is being used as your application pool identity and then set permissions for that user. It usually simplifies things when you use a specific user that is created solely for back-end purposes such as Windows services, web applications, queues, etc. – Eben Roux Nov 10 '16 at 07:29
  • @Eben -how can i check which user is being used as application pool identity –  Nov 10 '16 at 08:17
  • There is an "Identity" column in the application pool list in IIS Manager. Or you could select the "Advanced Settings..." in the context menu for the application pool in question. If you don't have an explicit user you could search the Net for how to set the permissions for the specified, pre-defined, user. It is still, usually, a bit easier working with a custom/explicit account that you have total control over. – Eben Roux Nov 10 '16 at 09:34

1 Answers1

0

You must to grant full access permission to your IIS User for each folder that your app need to write,delete or edit files.

I think you aren't do this well.

For more info for how to add permission and what is this try these:


UPDATE:

There are another good libraries for Zip & Unzip files in c# that we used on our projects. I suggest you to check them as well:

Community
  • 1
  • 1
Imran Sh
  • 1,623
  • 4
  • 27
  • 50