How can I handle maxRequestLength exceptions elegantly?
        Posted  
        
            by JMP
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by JMP
        
        
        
        Published on 2010-06-09T16:19:54Z
        Indexed on 
            2010/06/09
            16:22 UTC
        
        
        Read the original article
        Hit count: 359
        
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?
© Stack Overflow or respective owner