Y
yosi maurer
I use File.Delete(path) in my web application.
If the file for deletion is opened i expect to receive the exception:
"Additional information: The process cannot access the file [path]
because it is being used by another process."
The problem is that when the file is opened by a client machine then
the server that runs the code fails to delete but does not throw any
exception.
In this case i have no idea if the delete action succeeded or not.
Ofcourse i can use File.Exists after the delete action to check the
success.
I wanted to know if there is a more elegant solution for this problem.
If the file for deletion is opened i expect to receive the exception:
"Additional information: The process cannot access the file [path]
because it is being used by another process."
The problem is that when the file is opened by a client machine then
the server that runs the code fails to delete but does not throw any
exception.
In this case i have no idea if the delete action succeeded or not.
Ofcourse i can use File.Exists after the delete action to check the
success.
I wanted to know if there is a more elegant solution for this problem.