473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Directory.Delete of a non empty dir fails in ASP.NET application

Hello,

The method Directory.Delete(path, true) of .NET 2.0 called from within a web
app does not work correctly if the initial directory is not empty : all the
files inside the root directory and subdirectories are actually deleted, but
the leaf subdirectories in the tree remain "locked" (they are not accessible
anymore by the webapp or by Windows Explorer) until the webapp ends.

When the web app is ended, the leaf subdirectories actually disappear in the
explorer.

The directory to delete is inside the virtual dir of the web app.

When I try to delete recursively the files with File.Delete before calling
Directory.Delete, I get exactly the same problem.

Is there any fix to this problem ?

--
Olivier GIL
LAFON SA
Oct 26 '06 #1
5 2364
Hi Olivier,

Based on my test, the folder is locked by Visual Studio 2005 IDE if the
folder is already shown in project explorer. If you publish it in IIS and
run from there, the directories should be deleted correctly.

Unfortunately VS2005 Web Site mode doesn't have an option to let you
exclude the folders from your web site. If you want, you can use the Web
Application Project add-on for VS2005 for author your web site using normal
project mode like in VS2003 and ASP.NET 1.1. In this way, you can exclude
the folders from your project from project explorer and it will not lock
the folders.

#Visual Studio 2005 Web Application Project Option
http://webproject.scottgu.com/

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 27 '06 #2
Thank you Walter for the explanation. Unfortunalely, the Visual Studio 2005
support for Web applications is only available in english at the moment, and
I can not install it in my localized version (french). I hope it will be
integrated in a future service pack for Visual Studio 2005.
--
Olivier GIL
LAFON SA
"Walter Wang [MSFT]" wrote:
Hi Olivier,

Based on my test, the folder is locked by Visual Studio 2005 IDE if the
folder is already shown in project explorer. If you publish it in IIS and
run from there, the directories should be deleted correctly.

Unfortunately VS2005 Web Site mode doesn't have an option to let you
exclude the folders from your web site. If you want, you can use the Web
Application Project add-on for VS2005 for author your web site using normal
project mode like in VS2003 and ASP.NET 1.1. In this way, you can exclude
the folders from your project from project explorer and it will not lock
the folders.

#Visual Studio 2005 Web Application Project Option
http://webproject.scottgu.com/

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 27 '06 #3
Hi Olivier,

Thank you for your update.

I'm sorry that currently the Web Application Project add-on is only
available for English version of VS2005.

I'm afraid we will have to use other workaround for this issue. Based on my
test, the folder will not be locked by VS2005 IDE if it's not visible in
the Project Explorer. Do you think it's feasible that you create the folder
in explorer after you opened the web site in VS2005. Unless you do a
"Refresh" in Project Explorer, the folder will not be seen by the IDE.

Please feel free to submit your feedback at
http://connect.microsoft.com/Main/co...ContentID=2220.
Thank you for your understanding.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 30 '06 #4
Hi,

It will be difficult because VS2005 refreshes the Project Explorer each time
I start VS2005. I will submit the feedback as you suggested.

Thank you.

--
Olivier GIL
LAFON SA
"Walter Wang [MSFT]" wrote:
Hi Olivier,

Thank you for your update.

I'm sorry that currently the Web Application Project add-on is only
available for English version of VS2005.

I'm afraid we will have to use other workaround for this issue. Based on my
test, the folder will not be locked by VS2005 IDE if it's not visible in
the Project Explorer. Do you think it's feasible that you create the folder
in explorer after you opened the web site in VS2005. Unless you do a
"Refresh" in Project Explorer, the folder will not be seen by the IDE.

Please feel free to submit your feedback at
http://connect.microsoft.com/Main/co...ContentID=2220.
Thank you for your understanding.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 9 '06 #5
Hi Olivier,

Thank you for follow-up. Yes unfortunately VS2005 will refresh the Project
Explorer on startup, although it will not refresh it automatically after
the solution is already opened. I'm sorry for the inconvenience and thank
you for your feedback on the connect site.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 10 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: 73blazer | last post by:
Hello, I'm writing some C++ code, and I need to be able to find the number of files in a given directory. Is it possible under AIX4.3.3 with C++ 3.6.4? I cannot seem to locate anything of this...
5
by: Marcia Hon | last post by:
Hi, I would like to know how the following may be accomplished in C: 1. Check if a directory is empty. 2. Empty the directory. Please if you know how could you state what statements in C...
1
by: genc ymeri | last post by:
Hi over there, What command should I run to delete folders even if theirs subfolders are not empty with files ????? Thanks in advance.
7
by: Brian Cahill | last post by:
Hi, I am attempting to delete Profile folders from C:\Documents and Settings\. I am receiving a Permission denied error when using the Directory.Delete method. Here is my code. Is there any...
11
by: comp.lang.php | last post by:
Once again, I thought my class method deleteZip() would do the trick, but it never deletes any .zip* file found in a directory: /** * Delete any latent ZIP files found in this album. This...
7
by: Anil Gupte | last post by:
Private Sub mnu2Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu2Exit.Click Dim fDir As String = Path.GetDirectoryName(L3Global.VideoFileName) ...
3
by: Koliber (js) | last post by:
sorry for my bad english when I fire up (from my c# code) a standard "file - save as " dialog, and when chosen location is a shered local network directory, where I do have rights to create...
28
by: Peter Oliphant | last post by:
I have written a program using MS VS VC++ 2005 Express, /cli pure. Upon compiling it it works fine in the GUI development environment. It also works fine as a Debug stand-alone. ut I had an odd...
5
by: Gordon | last post by:
I'm trying to remove a directory and all its contents from within a script. I wrote a recursive function to take care of it, but when I run it I get random "Directory not empty" error messages. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.