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 9124931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:40:54+00:00 2026-06-17T06:40:54+00:00

This one is proving very difficult to debug. Lets start with my situation: I

  • 0

This one is proving very difficult to debug. Lets start with my situation:

I have an ASP.Net MVC3 web app developed with C# using .Net 4. Part of the system allows a user to upload a zip file. This is done fine, and the zip file is saved. There is also a Windows service which will periodically look for new zip files, extract them, do some work and then re-zip them back up. (I use System.IO.Compression for the zipping stuff). This part all works fine, after the processing I end up with a structure something like.

Object1Folder
 \_ Input.zip
 \_ ExtractedFolder
 \_ Output.zip

There is also a feature that allows the user to delete the item, and the requirement is to delete the object folder, in this case “Object1Folder”. Because I need to delete all sub folders and files I have the following recursive function to do the work…

public static void DeleteDirectory(string directoryPath)
{
    string[] files = Directory.GetFiles(directoryPath);
    string[] directories = Directory.GetDirectories(directoryPath);

    foreach (string file in files)
    {
        File.SetAttributes(file, FileAttributes.Normal);
        File.Delete(file);
    }

    foreach (string directory in directories)
    {
        DeleteDirectory(directory);
    }

    Directory.Delete(directoryPath, true);
}

Which is initially called something like…

DeleteDirectory("C:\\Objects\\Object1Folder");

But it doesn’t work! Firstly, there is no error thrown, the code appears to successfully execute, which is annoying. But the result is that only the “Input.zip” file is removed. The “ExtractedFolder” and “Output.zip” file remains.

As far as I can tell, the code is sound. I can’t see that it is a case that it doesn’t attempt to delete the remaining file and folder. Unfortuantely, we don’t have VS installed on the target server so I cannot step through the code and check that it attempts to delete them. Please point out if you can see this being a potential issue though?

My best guesses so far is that it is a permissions issue of some sort. What is interesting (perhaps) is that when I go to manual clean-up the problem (i.e. windows explorer delete of the “Object1Folder” it says “Denied” and asks me to confirm with the admin rights button thing that it does.

I know it’s hard for you all to work the problem out, but I am looking for things that I should check to try and solve this problem. What kind of things should I ensure have correct permissions? What permissions do they need? Is there a good way for me to debug this issue? If something else has a hold of those files (maybe from the extraction process of the Windows Service), how can I check if this is the problem?

Some information about that server that might help: It’s running “Windows Server 2008 R2 Datacenter” with service pack 1 and is 64-bit. The web app is assigned a user that is a member of both “Users” and “IIS_IUSRS”.

Let me know if any of you need some extra information.

  • 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-17T06:40:56+00:00Added an answer on June 17, 2026 at 6:40 am

    Have a look at the eventlog on the server; you might find an exception\error message there.

    You could consider using Directory.Delete(path, true) so you delete the folder and all its content in one call (unless I do not understand your code correctly).

    Have a look at files being in use. If a file is in use, the OS can’t delete it. So make sure you are releasing all files correctly.

    Finally, you can’t force the files to be not in use so you might end up writing a clean script that runs every night to delete unwanted files and folders.

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

Sidebar

Related Questions

I would have thought this was pretty easy, but it's proving more difficult than
This one's got me stumped and it's driving me nuts. I have a SiteFinity
This one is a little tricky. Say I have this XmlDocument <Object> <Property1>1</Property1> <Property2>2</Property2>
I have one activity - MainActivity . Within this activity I have two fragments,
I am having issues proving functional dependencies with Armstrong's Axioms. This one i'm struggling
Okay, here's what I have... On one server, a WCF hosted in IIS. This
This is one of the tasks of my assignment. I have a Turing machine
This should be an easy one to track down...but it isn't proving that way
I'm trying to move from stdio to iostream, which is proving very difficult. I've
This one's a head scratcher. I've created a commented jsFiddle to demonstrate the phenomenon

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.