How can I handle maxRequestLength exceptions elegantly?
- by JMP
In my ASP.NET MVC (v2 if it matters) app, I have a page that allows the user to upload a file. I've configured the maxRequestLength for my app to allow files up to 25MB. As a test, I send it a 500MB file which throws the exception: Maximum request length exceeded. (I only know this because ELMAH catches the error and logs it.)
In my web.config, I've set customErrors mode="On" with a defaultRedirect, but the user isn't redirected at all, they don't even get a yellow-screen-of-death. In Chrome, for example, you'll see the error: Error 101 (net::ERR_CONNECTION_RESET): Unknown error.
Is it possible to provide a more elegant user experience for this situation?