Hey Guys, I've been looking around for quite a while and feel that I have a particularly unique situation.
I am generating an image from a 3rd party program (which I embedded into my C# app) which is saved to the file system on my web server. Do you know of any efficient ways to dispose of these images after a particular session is completed?
For Clarity: Initially I was thinking about a folder (for my images stored by session ID) that has its contents automatically deleted every 24 hours or so. I don't like this idea because it's not really scalable.
I also looked at the ASP.NET dynamic image generation from this website. http://www.sitepoint.com/article/generating-asp-net-images-fly/
however this seems a little overkill because my image needs to be saved to the file system one way or another. If I save the image as a static name then generate a bitmap from it using the aforementioned method I am worried that concurrent usage could break the application.
This leaves me with saving the file names with the session ID in the name, however I can't find any efficient way of cleaning up the images after the session ends.
Thanks!
-Dave
Update: I like pretty much all the solutions presented so far (I don't think the database one will work because of the way I am exporting images) I appreciate all of your help... I will start working on implementing these and will report back which seems to work best!
Update2: I ended up randomly generating image names, storing them, then removing them at the end of the session, thanks for all your help. All the methods presented were excellent suggestions though. For this particular situation though this method works the best.