5

I have a user who is trying to upload a 150 megabyte file using an ASP.NET site. They are getting an HttpException:

System.Web.HttpException: Maximum request length exceeded.

I believe I can solve this by increasing the executionTimeout to 300 seconds (5 minutes) and maxRequestLength to 204800 kilobytes (200 megabytes). But are there any potential negative effects or dangers from doing this?

Johnathan Sewell
  • 739
  • 10
  • 26

1 Answers1

5

I would recommend only setting those larger values for the page that needs them rather than the site as a whole; both can be set programmatically for the page. Otherwise, I don't see a problem with the increased timeout and file size. You should probably include a warning that the upload could take up to 5 minutes so users don't keep hitting buttons (ie: ajax progress bar).

System.Web.Configuration.HttpRuntimeSection.MaxRequestLength and Server.ScriptTimeout

Zach Green
  • 3,421
  • 4
  • 29
  • 32
  • Thanks for the recommendation, I'll set these values on the page. Why do you use Server.ScriptTimeout rather than System.Web.Configuration.HttpRuntimeSection.ExecutionTimeout? – Johnathan Sewell Mar 14 '11 at 14:37
  • 1
    If you are setting it programmatically, you should use Server.ScriptTimeout. MSDN artilce explaining: http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.scripttimeout.aspx – Zach Green Mar 14 '11 at 19:24
  • I know you wrote this 5 years ago, but `Server.ScriptTimeout` simply doesn't seem to work anymore. – Zac May 23 '16 at 16:22