0

Possible Duplicate:
How to increase the max upload file size in ASP.NET?

i m trying to validate an uploaded content uploaded by user, it works fine if we upload content lesser than 2 MB's, but if we upload content more than 2MB's, withour undergoing any process, we get an error "Connection is reset."

is there and why to increase the limit in asp.net web.config file?

Community
  • 1
  • 1
Murtaza
  • 3,045
  • 2
  • 25
  • 39
  • hi, according to me when we upload the content there is a request to our server, therefore we need to set the Request size to the website. – Murtaza Oct 18 '11 at 08:52

3 Answers3

12

If you are trying to upload a file, set this to Web.Config under system.web section

  <httpRuntime maxRequestLength="51200" executionTimeout="3600" />

where maxRequestLength is the file size limit in KB and executionTimeout is the timeout in seconds. Set this value as per the requirement.

Prasanth
  • 3,029
  • 31
  • 44
  • can you explain what is execution timeout? and its advantage – Murtaza Oct 18 '11 at 08:53
  • executionTimeout is actually the value in seconds, not milliseconds. See [here](http://msdn.microsoft.com/en-us/library/e1f13641.aspx) for clarification and more web.config attribute definitions – musefan Nov 07 '11 at 09:54
4

add this to your web.config:

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="xxx" />
  </system.web>
</configuration>
Davide Piras
  • 43,984
  • 10
  • 98
  • 147
1

You can control the max upload size in asp.net by editing the maxRequestLength attribute in the web.config

How to increase the max upload file size in ASP.NET?

Community
  • 1
  • 1
Amr Elgarhy
  • 66,568
  • 69
  • 184
  • 301