调用HttpHanlder的几种返回方式小结

  1:如果只需要返回字符串形式的 例如内容、JSON字符串数组等

  context.Response.Write(resultPrice.ToString());

  2:如要要返回图片,那么采用流的形式

  bitmap.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

  3:如果返回文件,例如txt文档提供给客户端下载

  context.Response.WriteFile("文本实例.txt");