how to resolve maximum request length exceeded file upload asp.net

During large file upload in the ASP.NET we will get below error.

Server Error in '/' Application.
------------------------------
Maximum request length exceeded.


Solution:
By default 4MB only set in the machine.config file. We can over rite this setting by adding tags in the web.config file. Using below example i am giving max limit of 30 mb file you can upload through ASP.NET file uploader.


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

From IIS7 or later versions, it has built in request scanning support max 30 MB. For increasing IIS7 or versions memory we need to use below code in our web.config file.


<system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="3000000000" />
      </requestFiltering>
   </security>
</system.webServer>

Note: maxAllowedContentLength is measured in bytes while maxRequestLength is measured in kilobytes.

If you have any queries or suggestions, please feel free to ask in comments section.
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar