public class Handler : IHttpHandler { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "image/JPEG"; using (System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(300, 300)) { using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap)) { g.DrawString("IP:"+context.Request.UserHostAddress,new System.Drawing.Font("宋体",20),System.Drawing.Brushes.Red,0,0); g.DrawString("操作系统为:"+context.Request.Browser.Platform,new System.Drawing.Font("宋体",20),System.Drawing.Brushes.Pink,0,50); g.DrawString("浏览器的版本号为:" + context.Request.Browser.Type, new System.Drawing.Font("宋体", 13), System.Drawing.Brushes.Pink, 0, 100); g.DrawString("浏览器的版本号为:" + context.Request.Browser.Version, new System.Drawing.Font("宋体", 13), System.Drawing.Brushes.Pink, 0, 150); bitmap.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); } } }