views:

3369

answers:

5

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.

+2  A: 

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

JasonS
You would do this in the actual iframe that gets posted back, correct?
FlySwat
Yes, if you are getting the request timeout in the iframe, then that would where you set Server.ScriptTimeout.
JasonS
+2  A: 

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.

Godeke
maxRequestLength is actually in kilobytes. See http://msdn.microsoft.com/en-us/library/e1f13641.aspx
Daniel Chambers
You are right otherwise the small number I mention wouldn't make sense. Thanks, edited.
Godeke
+1  A: 

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" />
Brian Schmitt
A: 

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.

This doesn't directly address the question, and it may be an advertisement.
Odrade
A: 

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.

Carter