Skip navigation

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. 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.
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish