I have a asp:FileUpload control in my page. The default file size is 4MB. If I tried to upload a file more than 4MB, I would get an Internet Explorer cannot display the webpage. I put a breakpoint at the event handler for the upload, it didn’t stop there. The error message is too general, is there anyway I could make IE show me more specific error message?
Update: I couldn’t find a way to change the error message. I decided to use AJAX control AsyncFileUpload. It is a better version of the FileUpload.
One possible way to handle this error is to increase the quota in web.config to some very large value and then inside your handler check the size of the uploaded file and if it is grater than 4MB display an error message:
Modern browsers that support the HTML 5 File API also allow you to check the file size on the client before even uploading it so you could show an error message to the user when he selects a file: