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

G

Guest

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 ?
 
W

Walter Wang [MSFT]

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 ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
==================================================

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

Guest

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.
 
W

Walter Wang [MSFT]

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/content/content.aspx?ContentID=2220.
Thank you for your understanding.

Regards,
Walter Wang ([email protected], 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.
 
G

Guest

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.
 
W

Walter Wang [MSFT]

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 ([email protected], 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top