I have a simple image gallery where I want to allow users to delete files.
The problem I have is that after an image is displayed in the browser, I am
not able to delete the file because "The process cannot access the file ...
It is being used by another process". I also get this error when trying to
delete through explorer on the server. I can delete the file if I stop the
Web Server service... Is there a way around this?
Here is the code that fails:
System.IO.File.Delete(Page.MapPath(path_ &
clickedLink.Attributes.Item("photo_file")))
System.IO.File.Delete(Page.MapPath(path_ & "Thumbs/" &
clickedLink.Attributes.Item("photo_file")))