Csharp: Learn how to post JSON string to generic Handler using jQuery in ASP. Net C #.,
/// <Summary> /// example: http://james.newtonking.com/json/help/index.html# /// Geovin Du 20141228 // Jie for studio // </summary> public partial class _ Default: System. web. UI. page {Geovindu_TimeLineProjectInfo response = new response (); Response response = new response (); List <Geovindu_TimeLineDataInfo> response = new List <Geovindu_TimeLineDataInfo> (); geovindu_TimeLineDataInfo geovindu_TimeLineDataInfo = new Geovindu_TimeLineDataInfo (); partition = new partition (); Geovindu_TimeLineDataBLL partition = new partition (); /// <summary> //// </summary> /// <param name = "sender"> </param> /// <param name = "e "> </param> protected void Page_Load (object sender, eventArgs e) {try {geovindu_TimeLineProjectInfo = response (1); geovindu_TimeLineAssetProjectInfo = response (1); response = response (1); for (int I = 0; I <response; I ++) {selectGeovindu_TimeLineDataProject [I]. timeLineDataAssetInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetData (selectGeovindu_TimeLineDataProject [I]. timeDataID);} // context. response. contentType = "text/plain"; // context. response. write ("Hello World"); geovindu_TimeLineProjectInfo = Week (1); geovindu_TimeLineAssetProjectInfo = Week (1); week = Week (1); for (int I = 0; I <Week; I ++) {selectGeovindu_TimeLineDataProject [I]. timeLineDataAssetInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetData (selectGeovindu_TimeLineDataProject [I]. timeDataID);} JObject rss = new JObject (new JProperty ("timeline", new JObject (new JProperty ("headline", geovindu_TimeLineProjectInfo.TimeHeadline), new JProperty ("type", condition ), new JProperty ("text", geovindu_TimeLineProjectInfo.TimeText), new JProperty ("startDate", interval ("yyyy, MM, dd"), new JProperty ("asset ", new JObject (new JProperty ("media", feature), new JProperty ("credit", geovindu_TimeLineAssetProjectInfo.TimeAssetCredit), new JProperty ("caption", role ))), new JProperty ("date", from p in selectGeovindu_TimeLineDataProject orderby p. timeDataHeadline select new JObject (new JProperty ("startDate", p. timeDataStartDate. toString ("yyyy, MM, dd"), new JProperty ("headline", p. timeDataHeadline), new JProperty ("text", p. timeDataText), new JProperty ("asset", new JObject (// geovindu_TimeLineAssetDataInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetData (p. timeDataID) new JProperty ("media", p. timeLineDataAssetInfo. timeAssetMedia), new JProperty ("credit", p. timeLineDataAssetInfo. timeAssetCredit), new JProperty ("caption", p. timeLineDataAssetInfo. timeAssetCaption); Response. write (rss. toString (); File. writeAllText (Server. mapPath ("geovindu. json "), rss. toString ();} catch (Exception ex) {Response. write (ex. message. toString ());}}}}