1

How can I configurate WebApi Controller to read all data that passed in as a parameter?

Client:

  $.post(url,{id:aHugeData});

Controller:

 public class myController : ApiController
  {
   public List<string> Events(List<Event> id) //there must be 30 items, but I see 7
        {
            List<string> artists = new List<string>();
            foreach (Event e in id)
            {
                artists.AddRange(e.artists.artist);
            }
            artists = artists.Distinct().ToList();

            return artists;
        }
 }

in HttpContext I see that all data received.

1

1 Answer 1

1

Form Url Encoded Formatter doesn't want to read confoguration from
httpRuntime maxRequestLength="80000000", so in global.asax:

  public static void Configure(HttpConfiguration conf)
    {
        conf.Formatters.FormUrlEncodedFormatter.ReadBufferSize = int.MaxValue/10;
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.