Handling files uploaded with a size greater than maxRequestLength in web.config
<p>In my web.config, I have the file upload size limited to 10 MB:</p>

<pre><code>&lt;httpRuntime maxRequestLength="10000" /&gt; &lt;!-- file size limit in KB --&gt;
</code></pre>

<p>On my page, I'm checking to see that the user doesn't upload a file larger than 5 MB:</p>

<pre><code>protected void cvImageSize_ServerValidate(object source, ServerValidateEventArgs args)
{
    args.IsValid = (fupFile.PostedFile.InputStream.Length &lt;= 5000000);
}
</code></pre>

<p>If a user tries to upload a 3 MB file, it uploads fine. If a user tries to upload a 7 MB file, they are shown the error message from cvImageSize.</p>

<p>If a user tries to upload a 13 MB file...the site crashes. I'm not sure exactly what happens, Firefox gives me the page saying "<strong>The connection was reset. The connection to the server was reset while the page was loading.</strong>"</p>

<p>Is there some exception I can catch when the user tries to upload a file with a size greater than the maxRequestLength? I'd like to show the user an error message on the page instead of the site basically crashing.</p>
