This article is a mirror article of machine translation, please click here to jump to the original article.

View: 20025|Reply: 0

[ASP.NET] ASP.NET Parameter Pass, Length Limits, and Usage Precautions.

[Copy link]
Posted on 3/8/2018 10:18:07 AM | | | |
1. Causes of the problem
In the attachment "Post-Release Problems" of the bug statistics after the release of a project, there are:   



As an experience accumulation, these problems, causes and solutions will be included in the checklist, then:
The first question: Is the upper limit of the URL parameter accurate reference? What is the upper limit?
Second question: Why is there a limit on data when POST? Is the limit 128K?  
2. Problem analysis
1. The first one:
1) There is no upper limit of parameters in the URL. The problem is actually that IE has a length limit on URLs.
2) The HTTP protocol specification also does not limit the length of the URL. This limit is a limitation imposed by a specific browser and server. IE's limit on URL length is 2083 bytes (2K+35). For other browsers like Netscape, FireFox, etc., there is no theoretical length limit, and its limit depends on the support of the operating system. [Ref. 1]
3) "Variable-length parameters are passed via URL" actually means that the GET method is used when submitting the form, not the POST method. What causes this potential error is the use of the GET method to submit form data. Because the GET method passes the data in the URL to the server for processing.
4) Note that this limit is the entire URL length, not just your parameter value data length.
5) Since it is IE's limit on URL length, both the GET method and the POST method have this limitation.
(Please refer to the related document for details on the GET and POST methods of FORM [Ref. 2])  
Recommendations:
1) Understand the environment in which the application is located, such as the browser and server environment of the web application, and understand its specific parameter limitations.
2) Use the POST method as much as possible to submit complex data. Note: When FORM does not write the method attribute, the default is to use the GET method.
Conclusion (write to Checklist):
When submitting data using the GET method, you need to consider the URL length limit of 2083 bytes in the IE environment.
2. The second:
1) Theoretically, POST has no size limit. The HTTP protocol specification also has no size limit.
2) "There is a size limit of 128K for POST data" is not accurate enough, there is no limit to POST data, and the processing power of the server's processor plays a limiting role.
3) For ASP programs, there is a 100K data length limit when the Request object processes each form field. But with Request.BinaryRead there is no such limitation. For solutions that require processing more than 100K form domain data, please refer to [Ref. 3] below.
4) By extension, for IIS 6.0, Microsoft has increased the restrictions for security reasons [Ref. 4]. We also need to pay attention to:
   IIS 6.0 defaults to a maximum of 200 KB of ASP POST data, and the limit is 100 KB per form field.
    The default size of IIS 6.0 upload files is 4MB.
    IIS 6.0 defaults to a maximum request header of 16KB.
    These limitations were not available prior to IIS 6.0.
Recommendations:
1) Knowing the default settings of the running environment will help you design and quickly solve problems that arise.
2) Server version should be considered. Each version of IIS has different default settings for these parameters, so if necessary, find information and compile a comparison table. In this way, there is a reference for development and testing.
3) These limitations of IIS 6.0 are actually just its default settings, and you can modify them in the actual application environment.
    In WINNT/system32/inetsrv/MetaBase.xml, the default definition is:
        AspBufferingLimit="4194304" corresponds to the maximum size of the uploaded file
        AspMaxRequestEntityAllowed="204800" corresponds to the maximum amount of data in POST
        ...
Conclusion (write to Checklist):
When using ASP, you need to consider that the POST form has a limit of 100KB per field for general read processing. Consider whether to use Request.Binary.





Previous:asp.net mvc sets the form post to allow HTML submission
Next:System.Linq.Dynamic
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com