Tutorial :Preventing browser timeout on large file uploads



Question:

I have a nice little file upload control I wrote for ASP.NET webforms that utilizes an IFrame and ASP.NET AJAX.

However, on large uploads, the browser times out before it can finish posting the form.

Is there a way I can increase this?

I'm not really interesting in alternative solutions, so don't suggest changing the entire thing out please. It works good for <5 meg uploads, I'd just like to get it up to about 8mb.

EDIT: Setting the timeout in Page_Load didn't appear to change anything.


Solution:1

You need to update a metabase setting on IIS6 and later. The key is " AspMaxRequestEntityAllowed" and is expressed in bytes. I highly recommend the Metabase Explorer to make the change, wading through the XML at %systemroot%\system32\inetserv\metabase.xml is possible though.

Metabase Explorer: http://support.microsoft.com/kb/840671

Hmmm, perhaps I'm barking up the wrong tree... you wouldn't be doing 5 MB files if that wasn't already adjusted.

Another stab at it: see your web.config:

<system.web>    <httpRuntime  maxRequestLength="10240" executionTimeout="360"/>  </system.web>  

Max request length is in kilobytes and execution timeout is in seconds.


Solution:2

Place this in your web.config

  <system.web>       <httpRuntime executionTimeout="360" maxRequestLength="100000" />  

That enables a 360 second timeout and 100,000 Kb of upload data at a time.

If that doesn't work, run this command on your IIS server. (replace [IISWebsitename])

C:\Windows\System32\inetsrv>appcmd set config "[IISWebsitename]" -section:requestFiltering -requestLimits.maxAllowedContentLength:100000000 -commitpath:apphost  

That enables 100,000,000 bytes of upload data at a time.


Solution:3

In Page_Load, set Server.ScriptTimeout to a value that works for you. Measured in seconds I believe.


Solution:4

I think you may need to adjust the MaxRequestLength

Its in the Web.config I think by default its 4megs.

The following would allow ~10 meg file:

<httpRuntime maxRequestLength="10240" />  


Solution:5

Open your Web.config file, and just below the <system.web> tag, add the following tag:

<httpRuntime executionTimeout="90" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" />

Now, just take a look at the maxRequestLength="4096" attribute of the <httpRuntime> tag. As you may have realized, all you need to do is change the value to some other value of your choice (8192 for 8 Mb, 16384 for 16 Mb, 65536 for 64 Mb, and so on...).


Solution:6

Check the code of Velodoc XP Edition. It includes an upload streaming module, a resumable download handler and ASP.NET upload controls based on ASP.NET Ajax extensions and it is all open source.

For more information check also www.memba.com and www.velodoc.com.


Solution:7

I solved this using PHP with HTML:

  1. I start a session
  2. enter a loop
  3. create a loop that reloads the page that does part of the job at a time
  4. do until job is done
  5. the code inside the loop does a portion of the job
  6. increment a session variable to point to next part of the job
  7. reload the page using java script //this will restart the severs page timer
  8. loop
  9. load a page to report the job is done

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »