We have a form where for first time when you login check if a file exist and delete like this:
string check = "file1.pdf";
We need to delete that file always for the purposes of the form but is very clear if processes are attached to that file of other instances or whatever then ASP.NET say this message: "The process cannot access the file because it is being used by another process."
Of course we now that with try and catch we can catch the exception and send the message but is not what we want we want FORCE DELETE the file no matter if used or not. How can we force to delete the file? Sometimes inside the server could be users that are not closed properly and will never free the file that is the reason to kill the file literally.