C# ashx + ajax post 接受
$.ajax({ url: "ContentPage/Set.ashx?Time=" + new Date().getTime() + "&_AactionNamed=" + strActionName + "&_UserId=" + _tmpUserId + "", data: { "ChannelSets": JSON.stringify(userChannels)}, cache: false, type: "post", dataType: "json", contentType: 'application/json', success: function (data) { if (data != "") { } }, error: function () { } });
/// <summary> /// 创建 /// </summary> /// <param name="user"></param> /// <param name="context"></param> public void Create( HttpContext context) { var input= new Logistics.Beo.System.UspsOrderCancelChannelAddDto(); input.UserId=Logistics.Utils.CustomResponse.GetIntResponseArg("_UserId"); using (var reader = new StreamReader(context.Request.InputStream, Encoding.UTF8)) { var objJson2 = reader.ReadToEnd(); var objJson3 = System.Web.HttpUtility.UrlDecode(objJson2).Replace("ChannelSets=",""); var oj33= Logistics.Utils.NewtonsoftHelper.ToObject<List<Logistics.Beo.System.UspsOrderCancelChannelDto>>(objJson3); }
context.Response.Write("");
context.Response.End();
}