Search code examples
asp.nettemporary-files

How to deal with temporary files in ASP.NET?


Note that I'm not talking about the compiler-generated "Temporary ASP.NET Files".

My web application (ASP.NET MVC) uses Graphviz to generate images that are then fed to the client. This requires the creation of temporary files.

What's the best way to deal with these? Is there a way to delete them immediately after they're sent? Should I use a background thread? Something in Application_Start or Application_End?


Solution

  • couldn't you do it through a controller or use an ASHX (http://www.marklio.com/marklio/CommentView,guid,df8d6471-83fd-4f66-a799-ef8274979f0e.aspx) to stream out the content and delete the temp files once you had finished writing out the stream?