AsyncFileUpload “Cannot Access A Closed File exception

AsyncFileUpload “Cannot Access A Closed File exception

Quick post for those who may be suffering from a “Cannot Access A Closed File” exception when attempting to upload/save larger files with the AjaxControlToolkit AsyncFileUpload control…

Fix for me:

Add/edit an entry in your app’s web.config

<httpRuntime requestLengthDiskThreshold=”15360″ />

In my case this was caused by having a requestLengthDiskThreshold set too low, and was causing the file stream to close early.

8/29/2010 – *Update* Another issue you may be facing, is that your file size is exceeding the maxRequestLength setting.  To increase the size of this setting, you can define a web.config element like so (which will increase its size to approximately 2Gb allowed):

      <httpRuntime maxRequestLength="2097151" /> 
By | 2018-04-01T02:14:09+00:00 February 20th, 2011|Categories: ASP.NET|Tags: , , |3 Comments

About the Author:


  1. Phil Peters May 13, 2011 at 3:49 pm - Reply

    Thanks so much. That solved our issue!

  2. Gaston June 15, 2012 at 6:06 pm - Reply

    Great!!! Thanks for Argentina!!!

  3. elmer November 5, 2013 at 5:03 pm - Reply

    Excelente muy Bueno.

Leave A Comment