public void GetAlbumProfileImage(int albumId) { Image result = new Image(); result = ClassFunctions.GetAlbumProfileImage(albumId); JavaScriptSerializer js = new JavaScriptSerializer(); Context.Response.Clear(); Context.Response.ContentType = "application/json"; Context.Response.Write(js.Serialize(result)); }
public void ProcessRequest(HttpContext context) { try { Image image = null; byte[] bytes; int albumId = int.Parse(context.Request["id"]); image = ClassFunctions.GetAlbumProfileImage(albumId); context.Response.ContentType = image.ContentType; context.Response.BinaryWrite(image.Bytes); } catch (Exception ex) { context.Response.StatusCode = 500; context.Response.Write("Error occurred on server " + ex.Message); } }