While uploading a file using an ASP .Net Application we use a Fileupload button. I am not going to discuss the code here of how to upload a file using FileUpload button.
My main concern is that if you upload a file that is more than 4MB in size then you will get a webconfig error. Because by default the setting of the WebConfig does not allow files to be uploaded that are more than 4MB in size.
Now suppose you have developed an application which will need to upload a video file of more than 4 MB file. Then you have to attach the code below in the Webconfig file under the Compilation section.
<httpRuntime
executionTimeout="110"
maxRequestLength="62768"
requestLengthDiskThreshold="80"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="5000"
enableKernelOutputCache="true"
enableVersionHeader="true"
requireRootedSaveAsPath="true"
enable="true"
shutdownTimeout="90"
delayNotificationTimeout="5"
waitChangeNotification="0"
enableHeaderChecking="true"
sendCacheControlHeader="true"
apartmentThreading="false"
/>.
Here if you change the maxRequestLength property value then up to that size the file will be posted by the user.
Here the maxRequestLength property is 62768. That means that any file of less than 62768KB (62MB) in size can be uploaded through the web application.
You can change the other Property settings according to your need.

Lan HuuPosted Mar 13, 2017, 5:21 AM
How to add configuration setting above into Web.config by code behind C#?
test testPosted Mar 21, 2011, 9:42 AM
When the file is uploaded, it is stored in the server memory. The large file is allowed to upload, the less free memory you have. I recommend that you upload large files using small chunks, or via FTP
Sam HobbsPosted Mar 15, 2011, 3:31 AM
Does a large value for the httpRuntime Element's maxRequestLength attribute make a system vulnerable to denial of service attacks?