C# HTTP Error 413.1 - Request Entity Too Large - unable to gracefully handle this error

590 Views Asked by At

HTTP Error 413.1 - Request Entity Too Large The page was not displayed because the request entity is too large

HTTP Error 413.1 screen shot

This is a webforms app, and I have these set in web.config:

<security>
    <requestFiltering>
        <requestLimits maxAllowedContentLength="200288000" />
    </requestFiltering>
</security>

<httpRuntime executionTimeout="5400" maxRequestLength="200288" />

Those two settings set the max file size upload limits. However, when I test with a larger file, I get the IIS error page and am unable to gracefully catch and handle this error.

I've tried setting customErrors to On or Custom, but when the error occurs, it doesn't hit either the default redir or the custom redir?

<customErrors mode="On" defaultRedirect="/custom_error.aspx">
  <error statusCode="500" redirect="/custom_error.aspx" />
  <error statusCode="404" redirect="/not_found.aspx" />
  <error statusCode="413" redirect="/UploadError.aspx" />
</customErrors>

Any ideas?

0

There are 0 best solutions below