Images locked by go web

I am using GoIconicNode that loads images of bmp format that are different sizes from a filepath. For example, I call Initialize(null, filepath, “Test”) on rendering the nodes and all images load fine.

The problem comes when I want to edit one of the images. Whether the web page still has goview loaded or has been closed, the image becomes locked and cannot be edited. I have to kill aspnet_wp.exe process in order to unlock all images that were rendered. Is there something wrong in the way I’m loading the image file or can I call something in code to release the files? Should I be using a resx file in the first place?


That’s right – you should be using a resource file instead of accessing the image files on disk. All of the samples are organized that way.

Walter, our scenario goes like this:

- images are submitted by the users through fileUpload, saved on the server, paths make it to a db
- entities that are associated with the images are at some point also defined by the users and eventually make to a GoView
- the user may be interested in changing and resubmitting the image - again, through, fileUpload and seeing the changes' effect on a GoView
- we control the point of image submittal but have not been able to achieve unlock/reload-like functionality with resource managers
basically, we will greately appreciate any advice on how this can be done

The basic issue is that System.Drawing.Image.FromFile locks the file as long as the Image is in use.

I believe (but am not certain) that adding such Images to a ResourceManager would make a copy of the Image. (If that isn't the case, you could certain copy it explicitly.) The original Image could then be Disposed, thereby freeing the lock on the file.