<%@ WebHandler Language="C#" Class="image" %> using System; using System.Web; using SF.Comments; public class image : IHttpHandler { public void ProcessRequest (HttpContext context) { if (context.Request.QueryString["id"] == null) return; int id=-1; try{id=int.Parse(context.Request.QueryString["id"]);}catch{} CommentsManager cm = new CommentsManager(); string extension=cm.GetExtensionImage(id); if (!string.IsNullOrEmpty(extension)) context.Response.ContentType = "image/" + extension.Replace(".",""); else context.Response.ContentType = "image/JPEG"; byte[] image=cm.GetImage(id); if (image==null) return; context.Response.BinaryWrite(image); } public bool IsReusable { get { return false; } } }