Home  »  Articles  »  ASP.Net  »

Upload Large File to a Production Server

 Posted By : Manoranjan SahooPosted Date : 29/10/2010 06:02:38 AM Category : ASP.Net Points : 4 (Rs 1.00)

I got this question from many viewer, that how to upload large size file. So i am posting this.

When we upload a file to server, a size restriction is actually sent to the server for uploading. The default size limitation is 4MB (4096KB). So, if the file size is more than 4MB then the transfer fails.

A size restriction protects your application against “denial of service attack”. You want to prevent malicious users from uploading numerous large files to your Web server in an attempt to tie up all the available processes on the server. Such occurrence is called a “denial of service attack.” It ties up the Web server’s resources so that legitimate users are denied responses from the server.

You can usually change the default settings. To change the limit on the allowable upload file size, you make some changes in either the web.config file.

In the web.config file, find a node called <httpRuntime>. In this file, you see that the default allowable file size is dictated by the actual request size permitted to the Web server (4096KB). The <httpRuntime> section of the web.config file is shown below.

If there is no section with name <httpRuntime> then add the following things under <system.web> tag.

<httpRuntime
 executionTimeout="110"
 maxRequestLength="4096"
 requestLengthDiskThreshold="80"
 useFullyQualifiedRedirectUrl="false"
 minFreeThreads="8"
 minLocalRequestFreeThreads="4"
 appRequestQueueLimit="5000"
 enableKernelOutputCache="true"
 enableVersionHeader="true"
 requireRootedSaveAsPath="true"
 enable="true"
 shutdownTimeout="90"
 delayNotificationTimeout="5"
 waitChangeNotification="0"
 maxWaitChangeNotification="0"
 enableHeaderChecking="true"
 sendCacheControlHeader="true"
 apartmentThreading="false" />

When changing the maxRequestLength property, be aware of the setting provided for the executionTimeout property. This property sets the time (in seconds) for a request to attempt to execute to the server before ASP.NET shuts down the request. The default setting is 90 seconds.

Thank You.

Responses
No responses found for this thread. Be the first to respond this thread.
Post Reply
Login to post Response.