The maxRequestLength indicates the maximum file upload size supported by ASP.NET, the maxAllowedContentLength specifies the maximum length of content in a request supported by IIS. Maximum file sizes differ based on the operating system and its associated version of Internet Information Server (IIS). In most cases, sites will be hosted on IIS7 or later, so the maximum size of a file is the smallest of the two settings.
By default, the maximum size of a file to be uploaded to the server using the FileUpload control is around 4MB.
This value can be increased by modifying the maxRequestLength attribute in the web application’s configuration file (web.config)
<system.web>
<httpRuntime maxRequestLength=
"153600"
executionTimeout=
"900"
/>
</system.web>
In addition, the default maximum length of content in a request supported by IIS is around 28.6 MB.
This value can be increased by modifying the maxAllowedContentLength attribute in the web application’s configuration file (web.config)
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength=
"157286400"
/>
</requestFiltering>
</security>
</system.webServer>
The way the pipeline works is that the IIS value (maxAllowedContentLength) is checked first, then the ASP.NET value (maxRequestLength) is checked. If the content exceeds the IIS value (maxAllowedContentLength), then the user will get a 404.13 error page. If the content exceeds the ASP.NET value (maxRequestLength), then a exception is thrown (System.Web.HttpException: Maximum request length exceeded.) This excepton is typically caught by the web app, and is handled based on the <customErrors> setting (under <system.web>)