title: Better method to return Chunks of Data via jQuery, Ajax and ASP.Net
body: <p>I have an ajax method that retrieves data based on criteria set on the page, this can be a few to alot of records.  I changed my ajax call to poll 25 records at a time instead of returning a large dataset.</p>
  
  <p>The way I did this was on my WebMethod I run the sql based on the criteria and then I convert the rows to JSON and save to file on the first poll.  The subsequent ones simply load from the file back to classes so I can pick the next 25.  I need to run the data once on the first call and I can't simply pick 25 out because the function needs to load all records to perform other actions based on it.</p>
  
  <p>My problem now is that a very large set of data was returned for one report which threw the error: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.  </p>
  
  <p>I already have the max set so it's clear I need to think of another way to save the firstly run data and send it back in chunks, any ideas please?</p>
  
  <p>EDIT:
  Essentially I'm looking for a way to save the class to file and retrieve it on subsequent requests.</p>