1

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.

11
  • 1
    Could you show your code? How are you sending those arrays from the client and how your controller action looks like? Commented Apr 2, 2012 at 9:41
  • 1
    My guess is it's a 'GET' request and the array is blowing the max URL length of your web server or browser Commented Apr 2, 2012 at 9:53
  • Darin I edited the question. Andras, it's not GET request. I use jQuery $.post method. Commented Apr 2, 2012 at 9:56
  • Could you show this $.post method? Also could you show your controller action signature and the objects involved there? Commented Apr 2, 2012 at 9:57
  • @Dragouf - make sure the [HttpPost] attribute is applied to the action method and try it - what happens? Commented Apr 2, 2012 at 9:58

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.