When I upload a file via an application to a folder on the server with the required permissions granted therefore I have no problem deleting it form the folder via the same application. However, when I manually rename or replace the same uploaded file directly within the same folder, then I receive a "ACCESS DENIED" error as shown below when I try to delete it usingFile.Delete(ServerPath) from the application:
What changes? I have granted full access to the folder!
Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\~\folder\58827.doc' is denied.ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.