This is my code i have to delete an image when an instance of my Image Class is deleted from the db.
Image imgDelete = dbManagement.GetImageById(imageId);
string imageUrl = Server.MapPath(imgDelete.Url);
string thumbnailUrl = Server.MapPath(imgDelete.UrlThumbnail);
//delete thumbnail and big image files
File.Delete(imageUrl);
File.Delete(thumbnailUrl);
dbManagement.DeleteImage(imageId, imageUrl, thumbnailUrl);
I get this error saying for example: IOException. "The process cannot access the file 'E:\Dokuments\Programming Experiments\Finska Institutet\UserImages\singer.jpg' because it is being used by another process."
anyone here has a clue? Thanks guys!
Go to the complete details ...