Couple of weeks back, one of my friend who was working on a file upload page told me that his page throws an exception when a *huge* file is uploaded. Hope many of us would have faced similar situation previously!!!
The default limit in the size of file upload is 4 MB. This default setting can be overridden by making some minor changes to our Machine.config. In the configuration file we need to change the value for the attribute "MaxRequestLength" in the section "httpRuntime".
By default httpRuntime section in machine.config would look as follows:
<httpRuntime
executionTimeout="90"
maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"
enableVersionHeader="true"
/>
Here, change the value of "maxRequestLength" as per your requirement. Beware from now on machine wide the new value would be the default limit for all ASP.NET application.
On the flip side, if you want the size limit to be changed for a particular project then copying that section from machine.config and pasting it in web.config would do the trick.
The default limit in the size of file upload is 4 MB. This default setting can be overridden by making some minor changes to our Machine.config. In the configuration file we need to change the value for the attribute "MaxRequestLength" in the section "httpRuntime".
By default httpRuntime section in machine.config would look as follows:
<httpRuntime
executionTimeout="90"
maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"
enableVersionHeader="true"
/>
Here, change the value of "maxRequestLength" as per your requirement. Beware from now on machine wide the new value would be the default limit for all ASP.NET application.
On the flip side, if you want the size limit to be changed for a particular project then copying that section from machine.config and pasting it in web.config would do the trick.
Comments