Skip to main content

Posts

Showing posts from October, 2010

Error: "System.Web.HttpException: Maximum request length exceeded"

Problem When uploading large files in .NET, the following error may be received: System.Web.HttpException: Maximum request length exceeded...     This error relates to ASP.NET's maxRequestLength setting. By default,ASP.NET limits requests to 4096 kilobytes (or 4 MB), as explained inthis Microsoft KB article: http://support.microsoft.com/default.aspx?scid=kb;EN-US;295626 .  This error will occur if an upload is larger than 4 MB and you have notadjusted the maxRequestLength setting for your application inweb.config or machine.config.  To resolve this problem, use one of the following methods: In the Machine.config file, change the maxRequestLength attribute of the <httpRuntime> configuration section to a larger value. This change affects the whole computer. In the Web.config file, override the value of maxRequestLength for the application. For example, the following entry in Web.configallows files that are less than or equal to 8 megabytes (MB) to beuploaded:   <httpRun