Wednesday, December 10, 2008

Event code: 3004 File Upload too large

I have a custom application i've been working on and i was trying to upload a 5MB file with an asp fileupload control. This was giving me the dreaded "Internet Explorer Cannot Display the web page." error. I soon realized that the file size was the issue and added an httpruntime element to my web config file.

httpRuntime maxRequestLength="10240"

Ok, so i should be able to upload 10 meg files now. No luck. No matter how i configured the httpruntime element i kept getting the same error. IIS couldn't have been the issue because i was running the app from Visual Studio. I had been stumped for hours when i accidently figured out the issue.

We had several settings in our system.web section of the web config. I put the httpruntime tag at the end of the section. For some reason the application was not seeing it here. When i moved it directly after the tag, the file upload worked fine. I have no idea was causing the tag to work incorrectly or why the location mattered. Any thoughts feel free to share.

Frustrating. Thanks Microsoft.