0

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?

Kershaw
  • 1,124
  • 1
  • 7
  • 18
  • Need more info. Did code ever work? Is it only one page that is failing? We have to determine if issue is a connection issue or issue after the connection completes. Best way of debugging is use a sniffer like wireshark or fiddler. Check if you are using http or https (secure) which uses TLS for authentication. The TLS occurs before the request. If you do not get a request than TLS is failing. Check on sniffer the version of TLS being used. If request occurs than issue is occurring after the connection completes. Check status code in response to help determine issue. – jdweng May 12 '21 at 17:16
  • This is a single page with an upload feature using and asp.net FileUpload control. If I attempt to upload a smaller file than the size limits I have set, the page processes and uploads the file to the database with no issue. I am just trying to gracefully message the user if they attempt to upload a file larger than the size limits in my web.config. – Kershaw May 12 '21 at 17:30
  • You can refer to: https://forums.asp.net/t/2160766.aspx?HTTP+Error+413+1+Request+Entity+Too+Large+The+page+was+not+displayed+because+the+request+entity+is+too+large+ – Theobald Du May 14 '21 at 07:41

0 Answers0