HttpContext.Current.Response.ContentType = "application/json";
HttpContext.Current.Response.ContentEncoding = Encoding.UTF8;
Stream inputStream = HttpContext.Current.Request.InputStream;
Encoding encoding = HttpContext.Current.Request.ContentEncoding;
StreamReader streamReader = new StreamReader(inputStream, encoding);
string strJson = streamReader.ReadToEnd();
本文介绍如何在ASP.NET应用程序中设置响应类型为JSON,并读取来自客户端的JSON格式的数据。通过设置HttpContext的相关属性实现跨域请求处理。
1万+

被折叠的 条评论
为什么被折叠?



