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. image not being released [modified]

image not being released [modified]

Scheduled Pinned Locked Moved ASP.NET
csharpcssasp-netsysadminhelp
3 Posts 3 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.
  • G Offline
    G Offline
    g00fyman
    wrote on last edited by
    #1

    hi to all, I have a grid view (ASP.NET 2.0) that displays a list of products, when i click the delete image the row is deleted, then in the RowDeleted handler i attempt to delete the products images folder. and i get a message say the directory is locked by another process. I assume the process is the browser, but i dont see why if the row is deleted. How do i get around this problem, so I dont have unwanted fs directories laying about. this is my code

    protected void gridProducts_RowDeleted(object sender, GridViewDeletedEventArgs e)
    {
    if (e.Exception == null)
    {
    string code = (string)e.Values["ProductCode"];

      string path = SiteConfiguration.ProductImagesUploadDirectory;
      path = Server.MapPath(path);
      path = Path.Combine(path, code);
      
      if (Directory.Exists(path))
      {
        Directory.Delete(path, true);
      }
    }
    

    }

    kind regards, g00fy

    M V 2 Replies Last reply
    0
    • G g00fyman

      hi to all, I have a grid view (ASP.NET 2.0) that displays a list of products, when i click the delete image the row is deleted, then in the RowDeleted handler i attempt to delete the products images folder. and i get a message say the directory is locked by another process. I assume the process is the browser, but i dont see why if the row is deleted. How do i get around this problem, so I dont have unwanted fs directories laying about. this is my code

      protected void gridProducts_RowDeleted(object sender, GridViewDeletedEventArgs e)
      {
      if (e.Exception == null)
      {
      string code = (string)e.Values["ProductCode"];

        string path = SiteConfiguration.ProductImagesUploadDirectory;
        path = Server.MapPath(path);
        path = Path.Combine(path, code);
        
        if (Directory.Exists(path))
        {
          Directory.Delete(path, true);
        }
      }
      

      }

      kind regards, g00fy

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      I don't think it's the browser, but you can use the SysInternals tools[^] to check which application/process is holding the directory.

      1 Reply Last reply
      0
      • G g00fyman

        hi to all, I have a grid view (ASP.NET 2.0) that displays a list of products, when i click the delete image the row is deleted, then in the RowDeleted handler i attempt to delete the products images folder. and i get a message say the directory is locked by another process. I assume the process is the browser, but i dont see why if the row is deleted. How do i get around this problem, so I dont have unwanted fs directories laying about. this is my code

        protected void gridProducts_RowDeleted(object sender, GridViewDeletedEventArgs e)
        {
        if (e.Exception == null)
        {
        string code = (string)e.Values["ProductCode"];

          string path = SiteConfiguration.ProductImagesUploadDirectory;
          path = Server.MapPath(path);
          path = Path.Combine(path, code);
          
          if (Directory.Exists(path))
          {
            Directory.Delete(path, true);
          }
        }
        

        }

        kind regards, g00fy

        V Offline
        V Offline
        vik20
        wrote on last edited by
        #3

        Be careful when Using Directory.delete in ASP.net 2.0 Here is a link explaining why http://vikramlakhotia.com/Post.aspx?postID=6 Vikram

        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