<%@ WebHandler Language="C#" Class="Handler" %> using System; using System.Web; using System.Linq; using System.IO; using Newtonsoft.Json; using System.Collections; public class Handler : IHttpHandler { public void ProcessRequest (HttpContext context) { ZaaisterModelDataContext zmd = new ZaaisterModelDataContext(); if (context.Request.HttpMethod == "POST") { StreamReader stream = new StreamReader(context.Request.InputStream); string dataStr = stream.ReadToEnd(); // added to view content of input stream var datas = (Hashtable)JsonConvert.DeserializeObject(dataStr, typeof(Hashtable)); var id = datas["productBestelnr"]; var currentstockAmount = datas["currentstockVoorraad"]; try { zmd.SubmitChanges(); } catch (Exception e) { zmd.SubmitChanges(); } } var lijst = from a in zmd.Products select new { productBestelnr = a.productBestelnr, productOmschrijving = a.productOmschrijving, productMerk = a.productMerk, productStock = a.productStock }; string data = JsonConvert.SerializeObject(lijst.Take(300), Newtonsoft.Json.Formatting.Indented); context.Response.Write(data); } public bool IsReusable { get { return false; } } }