public class HelloController : Controller
{
// GET: Default
public void Index()
{
ResponseHeadersAdd("content-encoding", "gzip");
ResponseContentType = "application/json";
string json = "{\"status\":\"ok\"}";
var stream = new GZipStream(ResponseOutputStream, CompressionModeCompress);
byte[] jsonBuffer = UTF8EncodingUTF8GetBytes(json);
streamWrite(jsonBuffer, 0, jsonBufferLength);
streamClose();
}
}
//Webform就写在返回JSON的页面的Page_Load里面就行了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)