public async Task ProcessRequest(IDotvvmRequestContext context) { var id = Convert.ToInt32(context.Parameters["Id"]); var bytes = facade.GetImage(id); context.HttpContext.Response.ContentType = "image/jpeg"; await context.HttpContext.Response.Body.WriteAsync(bytes, 0, bytes.Length); }
public Task ProcessRequest(IDotvvmRequestContext context) { var id = Convert.ToInt32(context.Parameters["Id"]); var bytes = facade.GetImage(id); context.HttpContext.Response.ContentType = "image/jpeg"; context.HttpContext.Response.Body.Write(bytes, 78, bytes.Length - 78); // cut off the OLE header return(Task.CompletedTask); }