I’ve got a routine that tries to import files from an import directory, spitting them out to an Error directory if the import fails. The Error directory is shared and users have access permissions to delete files in there, so they can try to fix the problems and then move the files off to the import directory again. I use File.Move to move the files to the Error directory and this is working fine, apart from the permissions – it seems to revert to a default set of permissions, rather than the directory’s one, and so the users can’t remove the files – how can I reset the permissions on the file to those of their containing directory? I’ve tried poking around with SetAccessControl and SetAccessRuleProtection but I don’t seem to be having any luck?
Cheers
MH
This Asp.Net Forum link also discusses the same issue and it seems that you need to have administrative privileges. And as suggested in the forum too, this doesn’t seem like a good idea. If possible don’t delete the files through Asp.Net. Maybe, you can creat a windows service that can access the files and delete whichever are eligible. Just a hint. Giving too much power to Asp.Net is asking for trouble.