In my web.config, my file upload size is limited to 10 MB:
<httpRuntime maxRequestLength="10000" />
On my page, I verify that the user does not upload a file larger than 5 MB:
protected void cvImageSize_ServerValidate(object source, ServerValidateEventArgs args) { args.IsValid = (fupFile.PostedFile.InputStream.Length <= 5000000); }
If a user tries to download a 3 MB file, he downloads everything. If a user tries to download a 7 MB file, a cvImageSize error message is displayed.
If a user tries to upload a file of 13 MB in size ... the site crashes. I'm not sure what is happening, Firefox gives me a page with the message "The connection was reset. The connection to the server was reset while the page was loading. "
Is there any exception that I can catch when a user tries to upload a file with a size larger than maxRequestLength? I would like to show the user an error message on the page, and not just a website crash.
source share