Insus.NET猜,不是浏览器不兼容,就是代码有问题。
在代码中,只是输出数据流,图片格式很多种,如jpg,png,bmp等,没有指定,程序也不清楚要显示什么格式的图片。
因此,Insus.NET把代码改为如下:
context.Response.Buffer = false; FileStream inStr = null; byte[] buffer = new byte[1024]; long byteCount; inStr = File.OpenRead(path); while ((byteCount = inStr.Read(buffer, 0, buffer.Length)) > 0) { if (context.Response.IsClientConnected) { context.Response.ContentType = "image/png"; context.Response.OutputStream.Write(buffer, 0, buffer.Length); context.Response.Flush(); } }