Last post Aug 07, 2014 02:11 PM by Richard J
Jun 18, 2014 04:19 PM|Richard J|LINK
Does ASP.NET 4.5 still throw an exception when MaxHttpCollectionKeys is exceeded?
We have an ASP.NET web forms page that may submit more than 1000 form items and we previously had to increase the MaxHttpCollectionKeys default limit to get the page to work. I have recently upgraded the project containing this page to .NET 4.5.1 and after
removing the MaxHttpCollectionKeys element I now can't reproduce the original problem. I'd like to know if it's safe to remove MaxHttpCollectionKeys from the web.config file but obviously I don't want to re-introduce the original problem.
This MSDN page for .NET 4.5.1 does include MaxHttpCollectionKeys in its list of appSettings configuration keys and it says the default is 1000.
I can't find any post that says the limit has been removed or increased in .NET 4.5, but if that's the case why can I submit a page with over 1000 form items? (I debugged the page using Visual Studio and the Request.Form.Count was 1411). The PC has all security
updates applied via Windows Update so as far as I know it should enforce the limit.
Thanks for any guidance on this.
Aug 07, 2014 02:11 PM|Richard J|LINK
In case anyone else would like an answer to this:
I've used ILSpy to look at the .NET frameworks installed on my development PC. The 4.0 framework uses Int32.MaxValue for the default value. However the 2.0 framework uses 1000 for the default value.
So it looks like the default value has changed in .NET 4.5.1, which explains why I don't get an exception when the form input count exceeds 1000 items. Unfortunately the MSDN library (see link in my original post) appears to be out-of-date and still shows 1000
as the default value.