To implement the uploading of blob fields on the web, temporary directories are used to save the file to the server’s disk first and then upload it to the database
The directories are specified using the Blob Local Storage Path and Temp Media Directory model properties. To have the files automatically deleted, in Upgrade 3 you can create a global.asax file and save it to the application directory.
The file must contain the following code:
<%@ Import namespace=”System.IO” %>
<Script language=”C#” runat=”server”>
public void Application_OnStart()
Application[“TemporaryFilesToDelete”]= new ArrayList();
public void Application_OnEnd()
ArrayList toDelete = (ArrayList)(Application[“TemporaryFilesToDelete”]);
foreach( string fileName in toDelete)
This way the files will be deleted when the application’s memory usage exceeds the configured maximum or according to the recycling configuration. That is to say, when the process (Aspnet_wp or W3wp) is recycled, it deletes all the files that have been created since the application was started (and that haven’t been deleted after ending a session).
WARNING: This implementation has a high startup cost, which is an obstacle for prototyping. It implies that the person who executes the first request after restarting the process serving the web objects (w3wp or aspnet_wp) must run this deletion and therefore delay the request.