I have user uploaded file on my server. Now I need to delete those files.
When I'm using System.IO methods I'm getting System.UnauthorizedAccessException
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path 'D:\mywebsite\httpdocs\myfolder\1.jpg' is denied.
FileInfo fi = new FileInfo(filename));
How to delete file in programmatically?