Dragouf
Dragouf

Reputation: 4734

Max post array size in asp.net MVC?

I have a binding problem in asp.net MVC.

I want to post 2 arrays to an action.

The problem is that when my first array is more than 1000 elements the other one is refuses to.

Does anyone know why? And how can I correct this?

Here is the data I post to mvc action :

EPFPSelectionsSites[0].UrlSite www.monsite1.com
EPFPSelectionsSites[1].UrlSite www.monsite2.com
EPFPSelectionsSites[2].UrlSite www.monsite3.com
EPFPSelectionsSites[3].UrlSite www.monsite4.com

EPFPValeursSelectionSeries[0].NomSerie 1a3
EPFPValeursSelectionSeries[0].Valeur 5
EPFPValeursSelectionSeries[0].Valeur 6
EPFPValeursSelectionSeries[1].NomSerie 6a5
EPFPValeursSelectionSeries[1].Valeur 7
EPFPValeursSelectionSeries[1].Valeur 3

So when EPFPSelectionsSites is more than 1000 elements, EPFPSelectionsSites is limited and EPFPValeursSelectionSeries is not bind.But it work with less elements.

Thanks.

Upvotes: 1

Views: 2612

Answers (1)

danludwig
danludwig

Reputation: 47375

We had a similar issue in an older webforms app back in February. See this post for more details.

What we had to do was add this to our web.config file:

<appSettings>
    <add key="aspnet:MaxHttpCollectionKeys" value="3000"/>

After that, all of the HTTP collection keys that were needed by our page were successfully POSTed. Hopefully this security update is what is causing your issue, and overriding the new security setting using the appSetting will get you all of your array items posted.

Upvotes: 5

Related Questions