在ashx处理程序中,如果返回json串数据?

时间:2023-03-09 09:41:33
在ashx处理程序中,如果返回json串数据?

可以通过一下代码:

using System.Collections.Generic;
using System.Web.Script.Serialization; SortedDictionary<string, object> values = new SortedDictionary<string, object>();
values.Add("list", _sb.ToString());
values.Add("currentpage", pageIndex);
values.Add("endflg", pageIndex == datas.TotalPages);
context.Response.Write(new JavaScriptSerializer().Serialize(values));

相关文章