Web configuration setting in ASP.NET to post larger file.


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.

Up Next
    Ebook Download
    View all
    Learn
    View all