SIGN UP MEMBER LOGIN:    
ARTICLE

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

Posted by Shirsendu Nandi Articles | ASP.NET Programming March 14, 2011
Setting in web-config file to upload larger file for eg video or music file.
Reader Level:

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.

Login to add your contents and source code to this article
share this article :
post comment
 

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

Posted by test test Mar 21, 2011

Does a large value for the httpRuntime Element's maxRequestLength attribute make a system vulnerable to denial of service attacks?

Posted by Sam Hobbs Mar 15, 2011
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor