Cannot render image to HttpContext.Response.OutputStream

后端 未结 4 1835
面向向阳花
面向向阳花 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:01

    Ok I used a wrapper for Stream (implements Stream and passes calls to an underlying stream) to determine that Image.Save() calls Position and Length properties without checking CanSeek which returns false. It also tries to set Position to 0.

    So it seems an intermediate buffer is required.

提交回复
热议问题