Home » ASP.NET » Cannot access a closed file – FileUpload in ASP.NET

Cannot access a closed file – FileUpload in ASP.NET

This was very interesting error, I got during development of file upload control in ASP.NET.

On my local system, every thing was just fine. but when I deployed my application on development server, my control was able to upload only small size files.

Whenever I tried to upload large size file i got error “cannot access a closed file”.

After going through MSDN I found that there is one new element added in ASP.NET 2.0 known as httpRuntime.

So I just added this new Tag in my web.config and every thing was right.

 

<system.web>
<httpRuntime  maxRequestLength=”15360″ requestLengthDiskThreshold=”15360″/>
</system.web>

About

Informatics - my job & my passion.