Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. can't delete image

can't delete image

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    porsche996turbo
    wrote on last edited by
    #1

    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

    V G 2 Replies Last reply
    0
    • P porsche996turbo

      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

      V Offline
      V Offline
      Vipin Venugopal
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • P porsche996turbo

        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

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        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; }

        P 1 Reply Last reply
        0
        • G Guffa

          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; }

          P Offline
          P Offline
          porsche996turbo
          wrote on last edited by
          #4

          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?

          V D 2 Replies Last reply
          0
          • P porsche996turbo

            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?

            V Offline
            V Offline
            Vipin Venugopal
            wrote on last edited by
            #5

            if some program is using that file then there is no way u can delete that. Vipin

            1 Reply Last reply
            0
            • P porsche996turbo

              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?

              D Offline
              D Offline
              Daniel Santillanes
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups