首页 > Web开发 > 详细

asp.net处理json数据

时间:2015-11-11 16:17:07      阅读:332      评论:0      收藏:0      [点我收藏+]

客户端

1
2
3
4
5
6
7
8
9
10
11
12
$(‘#createAuth‘).click(function () {
    var jsonObj = { id:0, name:‘权限‘ + new Date() }
    $.ajax({
        type: ‘post‘,
        url: ‘service/authority/create.ashx‘,
        data: JSON.stringify(jsonObj),
        dataType: ‘json‘,
        success: function (d) {
            alert(d.Text);
        }
    });
});

  

服务端:

1
2
3
4
5
6
context.Response.ContentType = "application/json";
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
var request = context.Request.InputStream;
StreamReader sr = new StreamReader(request);
string json = HttpUtility.UrlDecode(sr.ReadToEnd());
sr.Close();

  

asp.net处理json数据

原文:http://www.cnblogs.com/ruishuang208/p/4956155.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!