ASP.NET: Delete A Directory In ASP.NET

This small function deletes a folder and all its contents from specified location on the server. This code is very handy as in ASP.NET you can not directly delete a folder if it is not empty. Therefor

ITPro Today

June 13, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today

This small function deletes a folder and all its contents from specified location on the server. This code is very handy as in ASP.NET you can not directly delete a folder if it is not empty. Therefore this code first delets all the content files and then removes the folder. Recursive call ensures the deletion of all the sub folders too.Important: Please ensure that the folder is given poper rights for local machine's ASP.NET Machine Account.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like