public void ProcessRequest(HttpContext context) { MemoryStream image = null; var imageId = (string)RequestContext.RouteData.Values["imageID"]; var hasContent = imageId == null ? false : true; if (hasContent) { var dbAction = new DBActions(); var eventDate = dbAction.GetDate(imageId); if (eventDate != null) { //DateTime TestDateTime = new DateTime(2016, 03, 15, 11, 55, 00); image = ImageRenderMethods.CreateGIF((DateTime)eventDate); } byte[] buffer = image.ToArray(); context.Response.ContentType = "image/gif"; context.Response.BinaryWrite(buffer); context.Response.Flush(); } }