Problem: currently, the default asp.net request form field length is 1000. If it exceeds one thousand, an error occurs, or the request. form cannot get the form data after 1000.
Test code:
<% @ Page Language = "C #" %>
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> No title page </title>
</Head>
<Body>
<Form id = "form1" runat = "server">
<%
Response. Write (Request. Params. AllKeys. Length );
Response. Write ("<br/> ");
For (int I = 0; I <3000; I ++)
{
Response. Write (string. Format ("<input type = 'text' name = 'txt {0} 'value =' {0} '/>", I ));
If (I % 5 = 0)
{
Response. Write ("<br/> ");
}
}
%>
<Input type = "submit" value = "submit"/>
</Form>
</Body>
</Html>
An error occurs when you click Submit. (1. The current status of the object invalidates the operation. 2. The URL encoding form data is invalid ):
Solution:
Add the following configuration in appSettings of Web. config:
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="5000" />
</appSettings>
If you submit the statement again, no error occurs. You can obtain information about all the forms.
Refer:
Http://blogs.msdn.com/ B /paulking/archive/2012/01/16/using-an-http-module-to-assist-in-adjusting-the-value-of-aspnet-maxhttpcollectionkeys-imposed-by-ms11-100.aspx