Answers for "c# aspx return image"

C#
0

c# aspx return image

string Path = Server.MapPath(Request.ApplicationPath + "\image.jpg");
Bitmap bmp = CreateThumbnail(Path,Size,Size);
Response.ContentType = "image/jpeg";
bmp.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
bmp.Dispose();
Posted by: Guest on June-16-2020
0

c# aspx return image

public class ImageHandler : IHttpHandler 
{ 
  public bool IsReusable { get { return true; } } 

  public void ProcessRequest(HttpContext ctx) 
  { 
    var myImage = GetImageSomeHow();
    ctx.Response.ContentType = "image/png"; 
    ctx.Response.OutputStream.Write(myImage); 
  } 
}
Posted by: Guest on June-16-2020

C# Answers by Framework

Browse Popular Code Answers by Language