Cannot render image to HttpContext.Response.OutputStream

后端 未结 4 1824
面向向阳花
面向向阳花 2021-01-05 06:43

Basically I am trying to render a simple image in an ASP.NET handler:

public void ProcessRequest (HttpContext context)
{
    Bitmap image = new Bitmap(16, 16         


        
4条回答
  •  渐次进展
    2021-01-05 07:21

    I believe the problem is that the Response.OutputStream does not support seeking. In order to save a PNG (or JPEG), the image object needs to be able to write the output non-sequentially. If I remember correctly, it would have worked if you saved the image as a BMP since that image format can be written without seeking the stream.

提交回复
热议问题