Frequently Asked Interview Questions
Error: System.Web.HttpException: Maximum request length exceeded

Problem When uploading large files in .NET, the following error may be received System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown
System.Web.HttpException: Maximum request length exceeded
This error relates to ASP.NET's maxRequestLength setting in configuration file. By default, ASP.NET limits requests to 4096 kilobytes (4MB).
This error will occur if an upload is larger than 4 MB and you have not adjusted the maxRequestLength setting for your application in web.config or machine.config.
 
Solution
 
The maxRequestLength parameter is set in the httpRuntime section of web.config (or machine.config). maxRequestLength is set in kilobytes. So, for example, if you want to allow uploads of 100 MB, you would set maxRequestLength to 102400. Adjust the settings according to the needs of your application.
 
<httpRuntime
executionTimeout="1200"
maxRequestLength="102400"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"
/>


Most Visited Pages

Home | Site Index | Contact Us