简体   繁体   中英

Web Forms error: Maximum Request Length Exceeded

Summary of the Problem: We have a list box on an old Web Forms (asp.net) page that can pull down thousands of options potentially. The issue is, when a certain size of data is reached any post backs (like clicking the save button) result in the following error:

System.Web.HttpException (0x80004005): Maximum request length exceeded.

How can the page be modified to handle this large volume of data?

Yes, before anyone puts this up as a solution, I am fully aware of the Web.config "dirty fix", and we are not doing it because we want to handle all the data.

Maximum request length exceeded

Also, I have attempted this in the elements with no success:

EnableViewState="false"
 <system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="104857600" />
      </requestFiltering>
   </security>
 </system.webServer>

Setting maxAllowedContentLength in the Web.config, is not a dirty fix, its a security setting that prevents content length more than allowed size.

For example imagine that you want to limit upload size, you will have some methods and functions for checking but this setting assures that even if there is a security hole in your methods and functions, the upload of a very large file will be prevented.

First you must set this setting to a value that that would be cover your content length. Then you should write codes to handle the data as you have mentioned.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM