can't delete image
-
how to resolve this? The process cannot access the file "C:\Inetpub\wwwroot\MetSysClient\Upload\Blue hills.jpg" because it is being used by another process.
Private Sub cmdDelImg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelImg.Click Try Dim sDelFile As String sDelFile = msLoc & sImageName & ".jpg" 'File.Delete(sDelFile) 'Using the FileInfo class Dim fInfo As FileInfo fInfo = New FileInfo(sDelFile) fInfo.Delete() Catch ex As Exception txtErrorMessage.Visible = True txtErrorMessage.Text = ex.Message End Try End Sub
-
how to resolve this? The process cannot access the file "C:\Inetpub\wwwroot\MetSysClient\Upload\Blue hills.jpg" because it is being used by another process.
Private Sub cmdDelImg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelImg.Click Try Dim sDelFile As String sDelFile = msLoc & sImageName & ".jpg" 'File.Delete(sDelFile) 'Using the FileInfo class Dim fInfo As FileInfo fInfo = New FileInfo(sDelFile) fInfo.Delete() Catch ex As Exception txtErrorMessage.Visible = True txtErrorMessage.Text = ex.Message End Try End Sub
Probably u will be using the same image as wallpaper or for some other purposes. U just try it out with some other image in ur system. Vipin
-
how to resolve this? The process cannot access the file "C:\Inetpub\wwwroot\MetSysClient\Upload\Blue hills.jpg" because it is being used by another process.
Private Sub cmdDelImg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelImg.Click Try Dim sDelFile As String sDelFile = msLoc & sImageName & ".jpg" 'File.Delete(sDelFile) 'Using the FileInfo class Dim fInfo As FileInfo fInfo = New FileInfo(sDelFile) fInfo.Delete() Catch ex As Exception txtErrorMessage.Visible = True txtErrorMessage.Text = ex.Message End Try End Sub
-
Some application is using the file, perhaps yours? Have you opened the file earlier, like displaying it in a picture box? If you don't dispose the image object properly, the file is still open.
--- b { font-weight: normal; }
the page is a thumbnail gallery.. maybe asp is using the image i really don't know.. but is there a way to delete it even if the image is open?
-
the page is a thumbnail gallery.. maybe asp is using the image i really don't know.. but is there a way to delete it even if the image is open?
if some program is using that file then there is no way u can delete that. Vipin
-
the page is a thumbnail gallery.. maybe asp is using the image i really don't know.. but is there a way to delete it even if the image is open?
If you opened the image with a stream, or some object and you didn't close it, yes, you won't be able to delete it. However if you are only referencing it as a source for an image object in asp.net, that isn't really holding it. Either there is a stream holding it or some other program you use in your PC. If unsure, try to delete manually, if you get the same message, reset iis, and try to delete manually again, if it's deleted then you have something in your program that's locking it, otherwise another program is locking it. If all else fails, may be asp.net doesn't have proper rights to delete it.
daniero