Click here to Skip to main content
14,357,409 members
Rate this:
Please Sign up or sign in to vote.
See more:
hoe remove the Exception when i delete the directory (give the Exception used by other program)

my code is this

if (Directory.Exists(@"C:\\WinDirectory"))
Directory.Delete(@"C:\WinDirectory", true);

what code write so that in asp,net so that our directory deleted each time
Posted
Updated 26-Feb-10 2:24am
v2
Rate this:
Please Sign up or sign in to vote.

Solution 1

If the directory is being used by another application then you can't get ride of the Exception. You can handle the exception though.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Could you please mention the exception that you are getting in the above code?
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

Probably the error you're getting is because ASP.Net needs more permissions to interact with the OS, you should start checking the setting for IIS, look here

IIS Security
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100