Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I resolve the "maximum request length exceeded" exception?

Tags:

asp.net

When I upload an image I had this error:

maximum request length exceeded

How can I fix this problem?

like image 238
Myworld Avatar asked Sep 08 '10 13:09

Myworld


People also ask

What does it mean when it says Maximum request length exceeded?

The default maximum filesize is 4MB - this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they'll get an error message: "Maximum request length exceeded."

What is Max request length?

HttpRuntime maxRequestLength Use the maxRequestLength of the httpRuntime element. The default size is 4096 kilobytes (4 MB).

What is maxRequestLength in web config?

The MaxRequestLength property specifies the limit for the buffering threshold of the input stream. For example, this limit can be used to prevent denial of service attacks that are caused by users who post large files to the server.


2 Answers

Add the following to your web.config file:

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

This sets it to 2GB. Not certain what the max is.

like image 68
Ta01 Avatar answered Oct 13 '22 20:10

Ta01


You can increase the maximum length of requests in web.config, under <system.web>:

<httpRuntime maxRequestLength="100000" /> 

This example sets the maximum size to 100 MB.

like image 43
Philippe Leybaert Avatar answered Oct 13 '22 18:10

Philippe Leybaert