3

Is there a way via IIS or ASP.Net of limiting the number of values that can be accessed via the Request.Form collection?

So, for example, if I have page A posting to page B and page A contains 50000 form fields is there anyway to configure page B so it can only access a maximum of 1000 request fields.

I'm asking this question as I suspect some pages on a web site I'm working on are only configured to accept a maximum of 1000 items in the Request.Form collection.

ipr101
  • 24,096
  • 8
  • 59
  • 61
  • Perhaps it's worth at least considering whether or not your page should be sending 50,000 form fields on a single request. Undoubtedly that's a significant amount of data to send across the wire. – Kiley Naro Jan 17 '12 at 16:41
  • 1
    50,000 is just an example figure. The page in question is posting just over 1000 form fields but the `Request.Form` collection of the page that is being posted to only contains 1000 items. – ipr101 Jan 17 '12 at 16:44
  • Even 1,000 is still a lot. I certainly hope you're not asking to the user to fill out every field... And if not, perhaps not all of the fields need to be passed? What I'm getting at here is not "you're above the randomly selected acceptable number of field elements to pass" but instead, *you should consider whether or not there's a way for you to improve your user-experience and/or reduce the amount of data you need to send in one request by not sending all of your fields in a single request* – Kiley Naro Jan 17 '12 at 16:46
  • How are you verifying that the number of fields from the post don't match? Do you have any form elements with the same name? – CAbbott Jan 17 '12 at 16:59

1 Answers1

6

I believe that the behaviour I described is caused by Security Update MS11-100

Microsoft security update MS11-100 limits the maximum number of form keys, files, and JSON members to 1000 in an HTTP request.

A resolution (which I've applied successfully to the 1.1 .net website I was working on) can be found here - http://support.microsoft.com/kb/2661403

ipr101
  • 24,096
  • 8
  • 59
  • 61
  • Also discussed in this question http://stackoverflow.com/questions/8684049/asp-net-ms11-100-how-can-i-change-the-limit-on-the-maximum-number-of-posted-for. I was of two minds as to whether this was a duplicate or not. ;-) – Chris Jan 18 '12 at 12:03
  • Thanks for pointing that out. I'd totally missed that question, and I was searching for stuff related to this for quite some time yesterday. My Google powers are maybe weaker than I thought! – ipr101 Jan 18 '12 at 13:14