调用HttpHanlder的几种返回方式小结_jquery
来源:懂视网
责编:小采
时间:2020-11-27 21:17:24
调用HttpHanlder的几种返回方式小结_jquery
调用HttpHanlder的几种返回方式小结_jquery:1:如果只需要返回字符串形式的 例如内容、JSON字符串数组等 context.Response.Write(resultPrice.ToString()); 2:如要要返回图片,那么采用流的形式 bitmap.Save(context.Response.OutputStream, System.Drawing.Im
导读调用HttpHanlder的几种返回方式小结_jquery:1:如果只需要返回字符串形式的 例如内容、JSON字符串数组等 context.Response.Write(resultPrice.ToString()); 2:如要要返回图片,那么采用流的形式 bitmap.Save(context.Response.OutputStream, System.Drawing.Im

1:如果只需要返回字符串形式的 例如内容、JSON字符串数组等
context.Response.Write(resultPrice.ToString());
2:如要要返回图片,那么采用流的形式
bitmap.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
3:如果返回文件,例如txt文档提供给客户端下载
context.Response.WriteFile("文本实例.txt");
调用HttpHanlder的几种返回方式小结_jquery
调用HttpHanlder的几种返回方式小结_jquery:1:如果只需要返回字符串形式的 例如内容、JSON字符串数组等 context.Response.Write(resultPrice.ToString()); 2:如要要返回图片,那么采用流的形式 bitmap.Save(context.Response.OutputStream, System.Drawing.Im