Posts Tagged ‘length’

“Maximum request length exceeded” in C#

In C# ASP.NET, I kept getting the following error message:

HttpException (0×80004005): Maximum request length exceeded.

To make matters worst, this is a type of error that catch does not recognize. In the end, I found a simple solution.

By default, the request length of any request is 2048kb. To increase the length, you need to add the following script to your web.config file and specify a length.

<configuration>
    <system.web>
        <httpRuntime maxRequestLength="32768" />
    </system.web>
</configuration>

With this solution, my web application is now able to accept files larger than 2mbs (and can actually accept a much larger 32mb). This application is an intranet web application used by trusted users.