Cannot delete file in share using impersonation on ASP.NET site
We have a web farm and are writing temp files for reports. We set up a file share and are using impersonation to write the temporary report files to that share. We gave the account doing the impersonation full control to the share and the folder itself.
The files are writing correctly but are not being deleted. Is there something we开发者_运维技巧're missing with this setup?
Not sure what method you are using to write the files. The following is what I ended up doing in order to read files. Maybe you could try this method for deleting them as well.
How can I temporarily impersonate a user to open a file?
Look at the "access denied" error event in Event Viewer and double-check that the user you expect to be doing the deletion is the actual user.
makesure you have closed the file in the procedure you use to write to the files otherwise it will be locked
精彩评论