How to resolve Maximum request length exceeded

During the uploading files via FileUpload , we got a error message like Maximum request length exceeded because The default maximum filesize is 4MB  and we upload more than that so we will get this error. This is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. So If a user uploads a file larger than 4MB, they'll get an error message: "Maximum request length exceeded."





Solutions:-

The 4MB default is set in machine.config, but you can override on your  web.config. For example ,we can  expand the upload limit to 20MB, add below code to web.config:

  <system.web>
    <httpRuntime executionTimeout="240" maxRequestLength="20480" />
  </system.web>

IIS7 (and later version) has a built-in request scanning which have upload file capacity which defaults to 30MB. To increase it, you also need to add the lines below:
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="3000000000" />
      </requestFiltering>
    </security>
  </system.webServer>



How to resolve Maximum request length exceeded How to resolve Maximum request length exceeded Reviewed by NEERAJ SRIVASTAVA on 5:14:00 PM Rating: 5

No comments:

Powered by Blogger.