Dev License: This installation of WHMCS is running under a Development License and is not authorized to be used for production use. Please report any cases of abuse to abuse@whmcs.com

In ASP.Net, while uploading large files using FileUpload control, you may have experienced an error saying that "Maximum request length exceeded". The default value of Maximum upload file size is set to 4 MB. In most cases, this limit is set to avoid DDoS attacks, large file uploads and few other reasons. So, when you try to upload a file with the size larger than 4 MB, you will start seeing this error.


Server Error in '/' Application.
------------------------------
Maximum request length exceeded.

Solution :


The default maximum file upload size for IIS is 4MB. Uploading more than 4MB file will give an error "Maximum request length exceeded"

machine.config file is set to 4MB default limit. We can change it to 20MB using the following code in the web.config.

< system.web >
< httpRuntime executionTimeout="240" maxRequestLength="20480" / >
< /system.web >

For IIS 7 and later versions, we can modify the default upload limit to 30MB. You will need to add the following code to the web.config.

< system.webServer >
      < security >
           < requestFiltering >
                < requestLimits maxAllowedContentLength="3000000000" / >
< /requestFiltering >
< /security >
< /system.webServer >

Note:

maxAllowedContentLength is estimated in bytes
maxRequestLength is estimated in kilobytes.
Was this answer helpful? 0 Users Found This Useful (1 Votes)

Powered by WHMCompleteSolution