I Use mvc and i have a controller that takes a file name and deletes it from server, when I use visual studio development server on my local machine, This Page(controller) successfully delete the file but on production server I'm getting the following Error:
The process cannot access the file 'filename' because it is being used by another process
System.IO.File.Delete(Server.MapPath("~/content/myFolder/" + id));
before this line of code I just do a custom request validation That dont access the file. This File has been saved by another Page Right before this page.
In fact I want to know Which Process May be accessing this file. and if any code from previous pages(controllers) may cause this Problem? i have searched but I found nothing useful.